mirror of
https://github.com/SillyTavern/SillyTavern-Extras.git
synced 2026-05-01 11:51:22 +00:00
Add error handing to emotion RVC mode
This commit is contained in:
@@ -180,35 +180,40 @@ def rvc_process_audio():
|
||||
|
||||
# HACK: emotion mode EXPERIMENTAL
|
||||
if classification_mode:
|
||||
print(DEBUG_PREFIX,"EXPERIMENT MODE: emotions")
|
||||
try:
|
||||
print(DEBUG_PREFIX,"EXPERIMENT MODE: emotions")
|
||||
|
||||
print("> Searching overide code ($emotion$)")
|
||||
emotion = None
|
||||
for code in ["anger","fear", "joy","love","sadness","surprise"]:
|
||||
if "$"+code+"$" in parameters["text"]:
|
||||
print(" > Overide detected:",code)
|
||||
emotion = code
|
||||
parameters["text"] = parameters["text"].replace("$"+code+"$","")
|
||||
print(parameters["text"])
|
||||
break
|
||||
print("> Searching overide code ($emotion$)")
|
||||
emotion = None
|
||||
for code in ["anger","fear", "joy","love","sadness","surprise"]:
|
||||
if "$"+code+"$" in parameters["text"]:
|
||||
print(" > Overide detected:",code)
|
||||
emotion = code
|
||||
parameters["text"] = parameters["text"].replace("$"+code+"$","")
|
||||
print(parameters["text"])
|
||||
break
|
||||
|
||||
if emotion is None:
|
||||
print("> calling text classification pipeline")
|
||||
emotions_score = classify_module.classify_text_emotion(parameters["text"])
|
||||
if emotion is None:
|
||||
print("> calling text classification pipeline")
|
||||
emotions_score = classify_module.classify_text_emotion(parameters["text"])
|
||||
|
||||
print(" > ",emotions_score)
|
||||
emotion = emotions_score[0]["label"]
|
||||
print(" > Selected:", emotion)
|
||||
print(" > ",emotions_score)
|
||||
emotion = emotions_score[0]["label"]
|
||||
print(" > Selected:", emotion)
|
||||
|
||||
model_path = folder_path+emotion+".pth"
|
||||
index_path = folder_path+emotion+".index"
|
||||
model_path = folder_path+emotion+".pth"
|
||||
index_path = folder_path+emotion+".index"
|
||||
|
||||
if not os.path.exists(model_path):
|
||||
print(" > WARNING emotion model pth not found:",model_path," will try loading default")
|
||||
if not os.path.exists(model_path):
|
||||
print(" > WARNING emotion model pth not found:",model_path," will try loading default")
|
||||
model_path = None
|
||||
|
||||
if not os.path.exists(index_path):
|
||||
print(" > WARNING emotion model index not found:",index_path)
|
||||
index_path = None
|
||||
except Exception as e:
|
||||
print(f" > ERROR: emotion mode failed {str(e)}")
|
||||
model_path = None
|
||||
|
||||
if not os.path.exists(index_path):
|
||||
print(" > WARNING emotion model index not found:",index_path)
|
||||
index_path = None
|
||||
|
||||
if model_path is None:
|
||||
|
||||
Reference in New Issue
Block a user