Spaces:
Runtime error
Runtime error
some more minor changes
Browse files
app.py
CHANGED
@@ -6,8 +6,6 @@ import regex as re
|
|
6 |
|
7 |
from pathlib import Path
|
8 |
import glob
|
9 |
-
from math import sqrt
|
10 |
-
import os
|
11 |
import matplotlib
|
12 |
|
13 |
matplotlib.use('Agg')
|
@@ -19,7 +17,7 @@ SELECTED_COLUMN_DICT = {
|
|
19 |
'merged_topic': ['tweet', 'main_topic', 'sub_topic', 'synonym_topic', 'cos_sim_topic', 'merged_topic'],
|
20 |
'sentiment': ['tweet', 'sentiment'],
|
21 |
'merged_target': ['tweet', 'target', 'synonym_target', 'cos_sim_target', 'merged_target']
|
22 |
-
|
23 |
|
24 |
USER_LIST = ['jimmieakesson', 'BuschEbba', 'annieloof', 'JohanPehrson', 'bolund', 'martastenevi', 'SwedishPM',
|
25 |
'dadgostarnooshi']
|
@@ -29,7 +27,8 @@ USER_NAMES = ['Jimmie Åkesson', 'Ebba Busch', 'Annie Lööf', 'Johan Pehrson',
|
|
29 |
|
30 |
CHOICE_LIST = ['Topic', 'Sentiment', 'Target']
|
31 |
|
32 |
-
# PLOT_CHOICES_DICT = {'Topic': 'sub_topic', 'Sentiment': 'sentiment', 'Target': 'target'} I just changed its pavue
|
|
|
33 |
PLOT_CHOICES_DICT = {'Topic': 'merged_topic', 'Sentiment': 'sentiment', 'Target': 'merged_target'}
|
34 |
PLOT_CHOICES_REVERSE_DICT = {'merged_topic': 'Topic', 'sentiment': 'Sentiment', 'merged_target': 'Target'}
|
35 |
# PLOT_CHOICES_REVERSE_DICT= {'sub_topic':'Topic', 'sentiment':'Sentiment' , 'target':'Target'}
|
@@ -82,7 +81,7 @@ def main(From,
|
|
82 |
):
|
83 |
save_file_bool = s1, s2, s3, s4, s5, s6, s7, s8
|
84 |
|
85 |
-
def
|
86 |
df_list = []
|
87 |
pie_charts = []
|
88 |
return_list = []
|
@@ -193,7 +192,7 @@ def main(From,
|
|
193 |
else:
|
194 |
save_selected_checkbox = [gr.Checkbox.update(interactive=True)]
|
195 |
|
196 |
-
pycharts =
|
197 |
|
198 |
rb_components = [rb1, rb2, rb3, rb4, rb5, rb6, rb7, rb8] # radio_buttons
|
199 |
df_visibility_check = [v1, v2, v3, v4, v5, v6, v7, v8]
|
|
|
6 |
|
7 |
from pathlib import Path
|
8 |
import glob
|
|
|
|
|
9 |
import matplotlib
|
10 |
|
11 |
matplotlib.use('Agg')
|
|
|
17 |
'merged_topic': ['tweet', 'main_topic', 'sub_topic', 'synonym_topic', 'cos_sim_topic', 'merged_topic'],
|
18 |
'sentiment': ['tweet', 'sentiment'],
|
19 |
'merged_target': ['tweet', 'target', 'synonym_target', 'cos_sim_target', 'merged_target']
|
20 |
+
}
|
21 |
|
22 |
USER_LIST = ['jimmieakesson', 'BuschEbba', 'annieloof', 'JohanPehrson', 'bolund', 'martastenevi', 'SwedishPM',
|
23 |
'dadgostarnooshi']
|
|
|
27 |
|
28 |
CHOICE_LIST = ['Topic', 'Sentiment', 'Target']
|
29 |
|
30 |
+
# PLOT_CHOICES_DICT = {'Topic': 'sub_topic', 'Sentiment': 'sentiment', 'Target': 'target'} I just changed its pavue
|
31 |
+
# to merged target and merged topic
|
32 |
PLOT_CHOICES_DICT = {'Topic': 'merged_topic', 'Sentiment': 'sentiment', 'Target': 'merged_target'}
|
33 |
PLOT_CHOICES_REVERSE_DICT = {'merged_topic': 'Topic', 'sentiment': 'Sentiment', 'merged_target': 'Target'}
|
34 |
# PLOT_CHOICES_REVERSE_DICT= {'sub_topic':'Topic', 'sentiment':'Sentiment' , 'target':'Target'}
|
|
|
81 |
):
|
82 |
save_file_bool = s1, s2, s3, s4, s5, s6, s7, s8
|
83 |
|
84 |
+
def add_pie_chart(df, leaders, plot_choices):
|
85 |
df_list = []
|
86 |
pie_charts = []
|
87 |
return_list = []
|
|
|
192 |
else:
|
193 |
save_selected_checkbox = [gr.Checkbox.update(interactive=True)]
|
194 |
|
195 |
+
pycharts = add_pie_chart(df, UserNameChoices, convert_plot_choices(plot_choice))
|
196 |
|
197 |
rb_components = [rb1, rb2, rb3, rb4, rb5, rb6, rb7, rb8] # radio_buttons
|
198 |
df_visibility_check = [v1, v2, v3, v4, v5, v6, v7, v8]
|