Spaces:
Running
Running
vickeee465
commited on
Commit
·
f382753
1
Parent(s):
0c4081a
restore heatmap
Browse files
app.py
CHANGED
@@ -123,7 +123,7 @@ def plot_sunburst_chart(heatmap_data):
|
|
123 |
values='score',
|
124 |
color='emotion',
|
125 |
hover_data={'score': ':.3f'},
|
126 |
-
title='Sentence-Level Emotion Confidence
|
127 |
)
|
128 |
|
129 |
fig.update_layout(
|
@@ -167,9 +167,9 @@ def predict_wrapper(text, language):
|
|
167 |
print(results_heatmap)
|
168 |
|
169 |
figure = plot_emotion_barplot(prepare_heatmap_data(results_heatmap))
|
170 |
-
|
171 |
output_info = f'Prediction was made using the <a href="https://huggingface.co/{model_id}">{model_id}</a> model.'
|
172 |
-
return results, figure, sunburst_chart, output_info
|
173 |
|
174 |
|
175 |
with gr.Blocks() as demo:
|
@@ -195,13 +195,16 @@ with gr.Blocks() as demo:
|
|
195 |
with gr.Row():
|
196 |
sunburst_chart = gr.Plot()
|
197 |
|
|
|
|
|
|
|
198 |
with gr.Row():
|
199 |
model_info = gr.Markdown()
|
200 |
|
201 |
predict_button.click(
|
202 |
fn=predict_wrapper,
|
203 |
inputs=[input_text, language_choice],
|
204 |
-
outputs=[result_table, plot, sunburst_chart, model_info]
|
205 |
)
|
206 |
|
207 |
if __name__ == "__main__":
|
|
|
123 |
values='score',
|
124 |
color='emotion',
|
125 |
hover_data={'score': ':.3f'},
|
126 |
+
title='Sentence-Level Emotion Confidence'
|
127 |
)
|
128 |
|
129 |
fig.update_layout(
|
|
|
167 |
print(results_heatmap)
|
168 |
|
169 |
figure = plot_emotion_barplot(prepare_heatmap_data(results_heatmap))
|
170 |
+
heatmap = plot_emotion_heatmap(prepare_heatmap_data(results_heatmap))
|
171 |
output_info = f'Prediction was made using the <a href="https://huggingface.co/{model_id}">{model_id}</a> model.'
|
172 |
+
return results, figure, sunburst_chart, heatmap, output_info
|
173 |
|
174 |
|
175 |
with gr.Blocks() as demo:
|
|
|
195 |
with gr.Row():
|
196 |
sunburst_chart = gr.Plot()
|
197 |
|
198 |
+
with gr.Row():
|
199 |
+
heatmap = gr.Plot()
|
200 |
+
|
201 |
with gr.Row():
|
202 |
model_info = gr.Markdown()
|
203 |
|
204 |
predict_button.click(
|
205 |
fn=predict_wrapper,
|
206 |
inputs=[input_text, language_choice],
|
207 |
+
outputs=[result_table, plot, sunburst_chart, heatmap, model_info]
|
208 |
)
|
209 |
|
210 |
if __name__ == "__main__":
|