Dzhuk commited on
Commit
2469c9d
1 Parent(s): 8061728

Update app.py 1.2

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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 "unknown"
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 "unknown"
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