raffaelsiregar commited on
Commit
fc4c547
·
verified ·
1 Parent(s): 233e565

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -147,16 +147,17 @@ def predict(wave):
147
  with torch.no_grad():
148
  prediction = model(wave)
149
  predicted_emotion, confidence = decode_emotion_prediction(prediction, le)
150
- return f"Predicted emotion: {predicted_emotion} (Confidence: {confidence*100:.4f})"
151
  except Exception as e:
152
  return f'Error in processing audio: {str(e)}'
153
 
154
  # Gradio Interface
155
  article = """
156
  ### How It Works
157
- - The model classifies the speech emotion given into 6 emotions (Angry, Happy, Sad, Disgusting, Fear, Neutral)
158
  - It returns the highest chance of the emotion and its confidence level.
159
- - This tool is built with CNN Architecture combined with LSTM Architecture.
 
160
  """
161
 
162
  iface = gr.Interface(
@@ -165,7 +166,7 @@ iface = gr.Interface(
165
  outputs="text",
166
  live=True,
167
  title="Speech Emotion Recognition",
168
- description="Record your voice to express an emotion and get the predicted emotion. The model only support English",
169
  article=article
170
  )
171
 
 
147
  with torch.no_grad():
148
  prediction = model(wave)
149
  predicted_emotion, confidence = decode_emotion_prediction(prediction, le)
150
+ return f"Your emotion is: {predicted_emotion} with {confidence*100:.4f}% confidence level."
151
  except Exception as e:
152
  return f'Error in processing audio: {str(e)}'
153
 
154
  # Gradio Interface
155
  article = """
156
  ### How It Works
157
+ - The model classifies the speech emotion given into 6 emotions (Angry, Happy, Sad, Disgusting, Fear, Neutral).
158
  - It returns the highest chance of the emotion and its confidence level.
159
+ - This model is built with CNN Architecture combined with LSTM Architecture.
160
+ - Please use English to record your voice.
161
  """
162
 
163
  iface = gr.Interface(
 
166
  outputs="text",
167
  live=True,
168
  title="Speech Emotion Recognition",
169
+ description="Record your voice to express an emotion and get the predicted emotion. The model only support English. Record it about 2-3 s",
170
  article=article
171
  )
172