faizhalas commited on
Commit
455af1b
1 Parent(s): a1ba240

Update pages/5 Burst Detection.py

Browse files
Files changed (1) hide show
  1. pages/5 Burst Detection.py +21 -1
pages/5 Burst Detection.py CHANGED
@@ -33,7 +33,7 @@ hide_streamlit_style = """
33
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
34
 
35
  with st.popover("🔗 Menu"):
36
- st.page_link("Home.py", label="Home", icon="🏠")
37
  st.page_link("pages/1 Scattertext.py", label="Scattertext", icon="1️⃣")
38
  st.page_link("pages/2 Topic Modeling.py", label="Topic Modeling", icon="2️⃣")
39
  st.page_link("pages/3 Bidirected Network.py", label="Bidirected Network", icon="3️⃣")
@@ -195,6 +195,10 @@ def apply_burst_detection(top_words, data):
195
  all_freq_data = all_freq_data.cumsum()
196
 
197
  return all_bursts, all_freq_data, num_unique_labels, num_rows
 
 
 
 
198
 
199
  # Streamlit UI for file upload
200
  uploaded_file = st.file_uploader('', type=['csv', 'txt'], on_change=reset_all)
@@ -295,6 +299,22 @@ if uploaded_file is not None:
295
  )
296
 
297
  st.plotly_chart(fig, theme="streamlit", use_container_width=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
 
299
  with tab2:
300
  st.markdown('**Kleinberg, J. (2002). Bursty and hierarchical structure in streams. Knowledge Discovery and Data Mining.** https://doi.org/10.1145/775047.775061')
 
33
  st.markdown(hide_streamlit_style, unsafe_allow_html=True)
34
 
35
  with st.popover("🔗 Menu"):
36
+ st.page_link("https://www.coconut-libtool.com/", label="Home", icon="🏠")
37
  st.page_link("pages/1 Scattertext.py", label="Scattertext", icon="1️⃣")
38
  st.page_link("pages/2 Topic Modeling.py", label="Topic Modeling", icon="2️⃣")
39
  st.page_link("pages/3 Bidirected Network.py", label="Bidirected Network", icon="3️⃣")
 
195
  all_freq_data = all_freq_data.cumsum()
196
 
197
  return all_bursts, all_freq_data, num_unique_labels, num_rows
198
+
199
+ @st.cache_data(ttl=3600)
200
+ def convert_df(df):
201
+ return df.to_csv().encode("utf-8")
202
 
203
  # Streamlit UI for file upload
204
  uploaded_file = st.file_uploader('', type=['csv', 'txt'], on_change=reset_all)
 
299
  )
300
 
301
  st.plotly_chart(fig, theme="streamlit", use_container_width=True)
302
+
303
+ csv1 = convert_df(freq_data)
304
+ csv2 = convert_df(bursts)
305
+
306
+ e1, e2 = st.columns(2)
307
+ e1.download_button(
308
+ "Press to download list of top keywords 👈",
309
+ csv1,
310
+ "top-keywords.csv",
311
+ "text/csv")
312
+
313
+ e2.download_button(
314
+ "Press to download the list of detected bursts 👈",
315
+ csv2,
316
+ "burst.csv",
317
+ "text/csv")
318
 
319
  with tab2:
320
  st.markdown('**Kleinberg, J. (2002). Bursty and hierarchical structure in streams. Knowledge Discovery and Data Mining.** https://doi.org/10.1145/775047.775061')