This commit is contained in:
henryruhs 2023-07-16 00:29:06 +02:00
parent f38239e370
commit 9aa5023642

View File

@ -6,8 +6,20 @@ from keras import Model
from roop.typing import Frame
PREDICTOR = None
THREAD_LOCK = threading.Lock()
MAX_PROBABILITY = 0.85
def get_predictor() -> Model:
global PREDICTOR
with THREAD_LOCK:
if PREDICTOR is None:
PREDICTOR = opennsfw2.make_open_nsfw_model()
return PREDICTOR
def clear_predictor() -> None:
global PREDICTOR