Spaces:
Runtime error
Runtime error
Update visualization.py
Browse files- visualization.py +3 -1
visualization.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import plotly.graph_objs as go
|
3 |
import re
|
|
|
4 |
|
5 |
def extract_data_and_explanation(text):
|
6 |
speakers_data = {}
|
@@ -20,6 +21,7 @@ def extract_data_and_explanation(text):
|
|
20 |
explanation = line.split("Explanation:", 1)[1].strip()
|
21 |
return speakers_data, explanation
|
22 |
|
|
|
23 |
def create_bar_chart(data, title):
|
24 |
fig = go.Figure(data=[go.Bar(
|
25 |
x=list(data.keys()),
|
@@ -41,7 +43,7 @@ def update_visibility_and_charts(status, exec_time, lang, attachments, bigfive,
|
|
41 |
for speaker, data in speakers_data.items():
|
42 |
if data:
|
43 |
fig = create_bar_chart(data, f"{analysis_type} Analysis - {speaker}")
|
44 |
-
outputs.append(fig
|
45 |
outputs.append(gr.update(value=explanation, visible=True, label=f"{analysis_type} Explanation - {speaker}"))
|
46 |
else:
|
47 |
outputs.append(None)
|
|
|
1 |
import gradio as gr
|
2 |
import plotly.graph_objs as go
|
3 |
import re
|
4 |
+
import json
|
5 |
|
6 |
def extract_data_and_explanation(text):
|
7 |
speakers_data = {}
|
|
|
21 |
explanation = line.split("Explanation:", 1)[1].strip()
|
22 |
return speakers_data, explanation
|
23 |
|
24 |
+
|
25 |
def create_bar_chart(data, title):
|
26 |
fig = go.Figure(data=[go.Bar(
|
27 |
x=list(data.keys()),
|
|
|
43 |
for speaker, data in speakers_data.items():
|
44 |
if data:
|
45 |
fig = create_bar_chart(data, f"{analysis_type} Analysis - {speaker}")
|
46 |
+
outputs.append(fig)
|
47 |
outputs.append(gr.update(value=explanation, visible=True, label=f"{analysis_type} Explanation - {speaker}"))
|
48 |
else:
|
49 |
outputs.append(None)
|