Update app.py
Browse files
app.py
CHANGED
@@ -48,8 +48,7 @@ def plotly_plot_audio(audio_path):
|
|
48 |
p = px.bar(data, x='Emotion', y='Probability', color="Probability")
|
49 |
return (
|
50 |
p,
|
51 |
-
f"
|
52 |
-
f"## π Dominant Emotion: {data['Emotion'].values[np.argmax(np.array(data['Probability']))]}"
|
53 |
)
|
54 |
|
55 |
except Exception as e:
|
@@ -71,8 +70,8 @@ def plotly_plot_audio(audio_path):
|
|
71 |
p = px.bar(data, x='Emotion', y='Probability', color="Probability")
|
72 |
return (
|
73 |
p,
|
74 |
-
f"
|
75 |
-
f"##
|
76 |
)
|
77 |
|
78 |
except Exception as e:
|
@@ -86,14 +85,14 @@ def plotly_plot_audio(audio_path):
|
|
86 |
)
|
87 |
|
88 |
def create_demo_text():
|
89 |
-
with gr.Blocks(theme=
|
90 |
gr.Markdown("# Text-based bilingual emotion recognition")
|
91 |
|
92 |
with gr.Row():
|
93 |
text_input = gr.Textbox(label="Write Text")
|
94 |
|
95 |
with gr.Row():
|
96 |
-
top_emotion = gr.Markdown("##
|
97 |
elem_classes="dominant-emotion")
|
98 |
|
99 |
with gr.Row():
|
@@ -103,8 +102,8 @@ def create_demo_text():
|
|
103 |
return demo
|
104 |
|
105 |
def create_demo_audio():
|
106 |
-
with gr.Blocks(theme=
|
107 |
-
gr.Markdown("# Text-based bilingual emotion recognition")
|
108 |
|
109 |
with gr.Row():
|
110 |
audio_input = gr.Audio(
|
@@ -115,7 +114,7 @@ def create_demo_audio():
|
|
115 |
interactive=True
|
116 |
)
|
117 |
with gr.Row():
|
118 |
-
top_emotion = gr.Markdown("##
|
119 |
elem_classes="dominant-emotion")
|
120 |
|
121 |
with gr.Row():
|
|
|
48 |
p = px.bar(data, x='Emotion', y='Probability', color="Probability")
|
49 |
return (
|
50 |
p,
|
51 |
+
f"## βοΈ Dominant Emotion: {data['Emotion'].values[np.argmax(np.array(data['Probability']))]}"
|
|
|
52 |
)
|
53 |
|
54 |
except Exception as e:
|
|
|
70 |
p = px.bar(data, x='Emotion', y='Probability', color="Probability")
|
71 |
return (
|
72 |
p,
|
73 |
+
f"π€ Transcription:\n{text}",
|
74 |
+
f"## βοΈ Dominant Emotion: {data['Emotion'].values[np.argmax(np.array(data['Probability']))]}"
|
75 |
)
|
76 |
|
77 |
except Exception as e:
|
|
|
85 |
)
|
86 |
|
87 |
def create_demo_text():
|
88 |
+
with gr.Blocks(theme='Nymbo/rounded-gradient', css=".gradio-container {background-color: #F0F8FF}", title="Emotion Detection") as demo:
|
89 |
gr.Markdown("# Text-based bilingual emotion recognition")
|
90 |
|
91 |
with gr.Row():
|
92 |
text_input = gr.Textbox(label="Write Text")
|
93 |
|
94 |
with gr.Row():
|
95 |
+
top_emotion = gr.Markdown("## βοΈ Dominant Emotion: Waiting for input ...",
|
96 |
elem_classes="dominant-emotion")
|
97 |
|
98 |
with gr.Row():
|
|
|
102 |
return demo
|
103 |
|
104 |
def create_demo_audio():
|
105 |
+
with gr.Blocks(theme='Nymbo/rounded-gradient', css=".gradio-container {background-color: #F0F8FF}", title="Emotion Detection") as demo:
|
106 |
+
gr.Markdown("# Text-based bilingual emotion recognition with audio transcription")
|
107 |
|
108 |
with gr.Row():
|
109 |
audio_input = gr.Audio(
|
|
|
114 |
interactive=True
|
115 |
)
|
116 |
with gr.Row():
|
117 |
+
top_emotion = gr.Markdown("## βοΈ Dominant Emotion: Waiting for input ...",
|
118 |
elem_classes="dominant-emotion")
|
119 |
|
120 |
with gr.Row():
|