Dpngtm commited on
Commit
79addda
·
verified ·
1 Parent(s): e907b48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -33,14 +33,15 @@ def recognize_emotion(audio):
33
  emotion_labels = ["angry", "calm", "disgust", "fearful", "happy", "neutral", "sad", "surprised"]
34
  return emotion_labels[predicted_id]
35
 
36
- # Gradio interface
37
  interface = gr.Interface(
38
  fn=recognize_emotion,
39
- inputs=gr.Audio(source="microphone", type="filepath"),
40
  outputs="text",
41
  title="Emotion Recognition with Wav2Vec2",
42
- description="Upload or record audio, and the model will predict the emotion."
43
  )
44
 
 
45
  # Launch the app
46
  interface.launch()
 
33
  emotion_labels = ["angry", "calm", "disgust", "fearful", "happy", "neutral", "sad", "surprised"]
34
  return emotion_labels[predicted_id]
35
 
36
+ # Gradio interface with both microphone and file upload options
37
  interface = gr.Interface(
38
  fn=recognize_emotion,
39
+ inputs=gr.Audio(source=["microphone", "upload"], type="filepath"),
40
  outputs="text",
41
  title="Emotion Recognition with Wav2Vec2",
42
+ description="Upload an audio file or record audio, and the model will predict the emotion."
43
  )
44
 
45
+
46
  # Launch the app
47
  interface.launch()