From 5bb0a3dd2bf484df1014a938047f6c5197fb04db Mon Sep 17 00:00:00 2001 From: Tony Ribeiro Date: Mon, 21 Aug 2023 17:50:29 +0200 Subject: [PATCH] start update classify module --- server.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/server.py b/server.py index 8e15aac..7cf9202 100644 --- a/server.py +++ b/server.py @@ -221,16 +221,6 @@ if "summarize" in modules: summarization_model, torch_dtype=torch_dtype ).to(device) -if "classify" in modules: - print("Initializing a sentiment classification pipeline...") - classification_pipe = pipeline( - "text-classification", - model=classification_model, - top_k=None, - device=device, - torch_dtype=torch_dtype, - ) - if "sd" in modules and not sd_use_remote: from diffusers import StableDiffusionPipeline from diffusers import EulerAncestralDiscreteScheduler @@ -337,6 +327,20 @@ if max_content_length is not None: print("Setting MAX_CONTENT_LENGTH to",max_content_length,"Mb") app.config["MAX_CONTENT_LENGTH"] = int(max_content_length) * 1024 * 1024 +# TODO: Keij, unify main classify and module one +if "classify" in modules: + print("Initializing a sentiment classification pipeline...") + classification_pipe = pipeline( + "text-classification", + model=classification_model, + top_k=None, + device=device, + torch_dtype=torch_dtype, + ) + + import modules.classify.classify_module as classify_module + classify_module.init_text_emotion_classifier(classification_model) + if "vosk-stt" in modules: print("Initializing Vosk speech-recognition (from ST request file)") vosk_model_path = (