mskov commited on
Commit
0c5e4a4
1 Parent(s): c8c950f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -40,10 +40,10 @@ class_options = {
40
 
41
  pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large")
42
 
43
- def classify_emotion():
44
  #### Emotion classification ####
45
  emotion_classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
46
- out_prob, score, index, text_lab = emotion_classifier.classify_file(audio_file)
47
  emostr = "emo class"
48
  return emo_dict[text_lab[0]], emostr
49
 
@@ -67,7 +67,7 @@ def classify_toxicity(audio_file, text_input, classify_anxiety, emo_class):
67
  print(toxicity_score)
68
  # emo call
69
  if emo_class != None:
70
- classify_emotion()
71
  #### Text classification #####
72
 
73
  device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
 
40
 
41
  pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large")
42
 
43
+ def classify_emotion(audio):
44
  #### Emotion classification ####
45
  emotion_classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
46
+ out_prob, score, index, text_lab = emotion_classifier.classify_file(audio)
47
  emostr = "emo class"
48
  return emo_dict[text_lab[0]], emostr
49
 
 
67
  print(toxicity_score)
68
  # emo call
69
  if emo_class != None:
70
+ classify_emotion(audio_file)
71
  #### Text classification #####
72
 
73
  device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")