Update app.py 1.2
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def detect_language(file_path):
|
|
31 |
return selected_language
|
32 |
except Exception as e:
|
33 |
print(f"Language detection failed: {e}")
|
34 |
-
return
|
35 |
|
36 |
|
37 |
def detect_emotion(audio):
|
@@ -59,7 +59,7 @@ def detect_toxic_local(text_whisper):
|
|
59 |
|
60 |
def assessment(file_path, result_text):
|
61 |
result_emotion = detect_emotion(file_path) or "unknown"
|
62 |
-
result_toxic = detect_toxic_local(result_text) or
|
63 |
return json.dumps({"emotion": result_emotion, "toxic": result_toxic})
|
64 |
|
65 |
|
|
|
31 |
return selected_language
|
32 |
except Exception as e:
|
33 |
print(f"Language detection failed: {e}")
|
34 |
+
return None
|
35 |
|
36 |
|
37 |
def detect_emotion(audio):
|
|
|
59 |
|
60 |
def assessment(file_path, result_text):
|
61 |
result_emotion = detect_emotion(file_path) or "unknown"
|
62 |
+
result_toxic = detect_toxic_local(result_text) or False
|
63 |
return json.dumps({"emotion": result_emotion, "toxic": result_toxic})
|
64 |
|
65 |
|