ameliabb0913 commited on
Commit
ffab20a
Β·
verified Β·
1 Parent(s): 9f99ff4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -25
app.py CHANGED
@@ -58,29 +58,18 @@ def classify_emotion(audio_file):
58
  return f"Predicted Emotion: {predicted_emotion} {emoji}"
59
 
60
 
61
- # ===== Redesigned Gradio UI with Blocks =====
62
- with gr.Blocks() as demo:
63
- gr.Markdown("""
64
- # 🎧 Speak Your Emotion | AI Emotion Detector
65
-
66
- Upload a voice recording or speak directly into your mic.
67
- This AI model will guess what **emotion** you're expressing.
68
-
69
- βœ… Great for:
70
- - Practicing emotional tone in speech
71
- - Testing AI capabilities
72
- - Language and drama learners
73
-
74
- _Emotions detected_: 😐 Neutral, 😊 Happy, 😒 Sad, 😠 Angry, 😨 Fearful, 🀒 Disgusted, 😲 Surprised
75
- """)
76
-
77
- with gr.Row():
78
- audio_input = gr.Audio(type="filepath", label="🎀 Upload or Record")
79
- result = gr.Textbox(label="🧠 AI Detected Emotion")
80
-
81
- submit_btn = gr.Button("🎯 Analyze Emotion")
82
- submit_btn.click(fn=classify_emotion, inputs=[audio_input], outputs=[result])
83
-
84
- # Launch!
85
  if __name__ == "__main__":
86
- demo.launch()
 
 
58
  return f"Predicted Emotion: {predicted_emotion} {emoji}"
59
 
60
 
61
+ # Gradio Interface
62
+ interface = gr.Interface(
63
+ fn=classify_emotion,
64
+ inputs=gr.Audio(type="filepath"),
65
+ outputs="text",
66
+ title="🎧 Speak Your Emotion | AI Emotion Detector",
67
+ description=(
68
+ "🎀 Upload a voice clip or speak into the mic β€” this AI will identify the **emotion** in your voice!\n\n"
69
+ "**Supported 8 Emotions**: Neutral, Happy, Sad, Angry, Fearful, Disgusted, Surprised."
70
+ )
71
+
72
+ # Launch the app
 
 
 
 
 
 
 
 
 
 
 
 
73
  if __name__ == "__main__":
74
+ interface.launch()
75
+