ifisch commited on
Commit
706a6a6
·
verified ·
1 Parent(s): 73bab1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -10
app.py CHANGED
@@ -142,19 +142,44 @@ def main():
142
 
143
 
144
  col1, col2, col3, col4 = st.columns(4)
145
- if col1.button("Die AfD Topic Analysis" ):
146
- url = "./topic_analysis/afd_topics_trigram_bar_bert.html"
147
- webbrowser.open_new_tab(url)
 
 
 
148
  if col2.button("CDU/CSU Topic Analysis"):
149
- url = "./topic_analysis/cdu_topics_trigram_bar_bert.html"
150
- webbrowser.open_new_tab(url)
 
 
151
  if col3.button("Die Grünen Topic Analysis"):
152
- url = "./topic_analysis/gruene_topics_trigram_bar_bert.html"
153
- webbrowser.open_new_tab(url)
 
 
154
  if col4.button("Die Linke Topic Analysis"):
155
- url = "./topic_analysis/linke_topics_trigram_bar_bert.html"
156
- webbrowser.open_new_tab(url)
157
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
  if __name__ == "__main__":
160
  initialize_session_state()
 
142
 
143
 
144
  col1, col2, col3, col4 = st.columns(4)
145
+
146
+ if col1.button("Die AfD Topic Analysis"):
147
+ st.session_state.show_afd = not st.session_state.show_afd
148
+ st.session_state.show_cdu_csu = False
149
+ st.session_state.show_gruene = False
150
+ st.session_state.show_linke = False
151
  if col2.button("CDU/CSU Topic Analysis"):
152
+ st.session_state.show_afd = False
153
+ st.session_state.show_cdu_csu = not st.session_state.show_cdu_csu
154
+ st.session_state.show_gruene = False
155
+ st.session_state.show_linke = False
156
  if col3.button("Die Grünen Topic Analysis"):
157
+ st.session_state.show_afd = False
158
+ st.session_state.show_cdu_csu = False
159
+ st.session_state.show_gruene = not st.session_state.show_gruene
160
+ st.session_state.show_linke = False
161
  if col4.button("Die Linke Topic Analysis"):
162
+ st.session_state.show_afd = False
163
+ st.session_state.show_cdu_csu = False
164
+ st.session_state.show_gruene = False
165
+ st.session_state.show_linke = not st.session_state.show_linke
166
+
167
+ if st.session_state.show_afd:
168
+ with open("./topic_analysis//afd_topics_trigram_bar_bert.html", "r", encoding='utf-8') as file:
169
+ afd_html = file.read()
170
+ components.html(afd_html, height=800, scrolling=True)
171
+ if st.session_state.show_cdu_csu:
172
+ with open("./topic_analysis//cdu_topics_trigram_bar_bert.html", "r", encoding='utf-8') as file:
173
+ cdu_html = file.read()
174
+ components.html(cdu_html, height=800, scrolling=True)
175
+ if st.session_state.show_gruene:
176
+ with open("./topic_analysis//gruene_topics_trigram_bar_bert.html", "r", encoding='utf-8') as file:
177
+ gruene_html = file.read()
178
+ components.html(gruene_html, height=800, scrolling=True)
179
+ if st.session_state.show_linke:
180
+ with open("./topic_analysis//linke_topics_trigram_bar_bert.html", "r", encoding='utf-8') as file:
181
+ linke_html = file.read()
182
+ components.html(linke_html, height=800, scrolling=True)
183
 
184
  if __name__ == "__main__":
185
  initialize_session_state()