Update app.py
Browse files
app.py
CHANGED
@@ -58,29 +58,18 @@ def classify_emotion(audio_file):
|
|
58 |
return f"Predicted Emotion: {predicted_emotion} {emoji}"
|
59 |
|
60 |
|
61 |
-
#
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
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 |
-
|
|
|
|
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 |
+
|