Spaces:
Running
Running
Commit
·
7251537
1
Parent(s):
946844d
Update app.py
Browse files
app.py
CHANGED
@@ -161,6 +161,19 @@ def dist(output_file, input_checks):
|
|
161 |
'Frequency': [3, 5, 1, 8, 2, 3, 4, 7, 1, 12, 4, 2, 3, 6, 3, 10, 3, 4],
|
162 |
'Emotion category': ['neutral', 'anger', 'fear', 'joy', 'love', 'sadness', 'neutral', 'anger', 'fear', 'joy', 'love', 'sadness', 'neutral', 'anger', 'fear', 'joy', 'love', 'sadness']})
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
domain = ['neutral', 'anger', 'fear', 'joy', 'love', 'sadness']
|
165 |
range_ = ['#999999', '#b22222', '#663399', '#ffcc00', '#db7093', '#6495ed']
|
166 |
n = max(data['Frequency'])
|
@@ -179,6 +192,7 @@ def dist(output_file, input_checks):
|
|
179 |
else:
|
180 |
return gr.update(value=plot, visible=True), gr.update(visible=False), gr.update(visible=False) # no next_button becomes available
|
181 |
|
|
|
182 |
def peaks(output_file, input_checks):
|
183 |
output = "There are peaks on some dates."
|
184 |
if "topics" in input_checks:
|
|
|
161 |
'Frequency': [3, 5, 1, 8, 2, 3, 4, 7, 1, 12, 4, 2, 3, 6, 3, 10, 3, 4],
|
162 |
'Emotion category': ['neutral', 'anger', 'fear', 'joy', 'love', 'sadness', 'neutral', 'anger', 'fear', 'joy', 'love', 'sadness', 'neutral', 'anger', 'fear', 'joy', 'love', 'sadness']})
|
163 |
|
164 |
+
if "peaks" in input_checks:
|
165 |
+
return gr.LinePlot.update(data,x="Date",y="Frequency",color="Emotion category",color_legend_position="bottom",title="Emotion distribution over time",tooltip=['Date', 'Frequency', 'Emotion category'],height=300,width=500,visible=True), gr.update(visible=True), gr.update(visible=False) # next_button_peaks becomes available
|
166 |
+
elif "topics" in input_checks:
|
167 |
+
return gr.LinePlot.update(data,x="Date",y="Frequency",color="Emotion category",color_legend_position="bottom",title="Emotion distribution over time",tooltip=['Date', 'Frequency', 'Emotion category'],height=300,width=500,visible=True), gr.update(visible=False), gr.update(visible=True) # next_button_topics becomes available
|
168 |
+
else:
|
169 |
+
return gr.LinePlot.update(data,x="Date",y="Frequency",color="Emotion category",color_legend_position="bottom",title="Emotion distribution over time",tooltip=['Date', 'Frequency', 'Emotion category'],height=300,width=500,visible=True), gr.update(visible=False), gr.update(visible=False) # no next_button becomes available
|
170 |
+
|
171 |
+
def dist_colors(output_file, input_checks):
|
172 |
+
data = pd.DataFrame({
|
173 |
+
'Date': ['1/1', '1/1', '1/1', '1/1', '1/1', '1/1', '2/1', '2/1', '2/1', '2/1', '2/1', '2/1', '3/1', '3/1', '3/1', '3/1', '3/1', '3/1'],
|
174 |
+
'Frequency': [3, 5, 1, 8, 2, 3, 4, 7, 1, 12, 4, 2, 3, 6, 3, 10, 3, 4],
|
175 |
+
'Emotion category': ['neutral', 'anger', 'fear', 'joy', 'love', 'sadness', 'neutral', 'anger', 'fear', 'joy', 'love', 'sadness', 'neutral', 'anger', 'fear', 'joy', 'love', 'sadness']})
|
176 |
+
|
177 |
domain = ['neutral', 'anger', 'fear', 'joy', 'love', 'sadness']
|
178 |
range_ = ['#999999', '#b22222', '#663399', '#ffcc00', '#db7093', '#6495ed']
|
179 |
n = max(data['Frequency'])
|
|
|
192 |
else:
|
193 |
return gr.update(value=plot, visible=True), gr.update(visible=False), gr.update(visible=False) # no next_button becomes available
|
194 |
|
195 |
+
|
196 |
def peaks(output_file, input_checks):
|
197 |
output = "There are peaks on some dates."
|
198 |
if "topics" in input_checks:
|