Porjaz commited on
Commit
c055b7f
1 Parent(s): 5cc84b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -158,8 +158,13 @@ class CustomEncoderWav2vec2Classifier(Pretrained):
158
 
159
 
160
  def return_prediction(mic, file):
161
- classifier = foreign_class(source="Porjaz/wavlm-base-emo-fi", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
162
- out_prob, score, index, text_lab = classifier.classify_file("anger.wav")
 
 
 
 
 
163
  return text_lab
164
 
165
 
@@ -175,4 +180,4 @@ gradio_app = gr.Interface(
175
  title="Finnish-Emotion-Recognition",
176
  )
177
 
178
- gradio_app.launch(share=True)
 
158
 
159
 
160
  def return_prediction(mic, file):
161
+ # classifier = foreign_class(source="Porjaz/wavlm-base-emo-fi", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
162
+ if mic is not None:
163
+ out_prob, score, index, text_lab = classifier.classify_file(mic)
164
+ elif file is not None:
165
+ out_prob, score, index, text_lab = classifier.classify_file(file)
166
+ else:
167
+ return "You must either provide a mic recording or a file"
168
  return text_lab
169
 
170
 
 
180
  title="Finnish-Emotion-Recognition",
181
  )
182
 
183
+ gradio_app.launch(share=True, ssl_verify=False)