Spaces:
Running
Running
Update pages/2 Topic Modeling.py
Browse files- pages/2 Topic Modeling.py +26 -13
pages/2 Topic Modeling.py
CHANGED
@@ -8,6 +8,7 @@ nltk.download('wordnet')
|
|
8 |
from nltk.stem import WordNetLemmatizer
|
9 |
nltk.download('stopwords')
|
10 |
from nltk.corpus import stopwords
|
|
|
11 |
import gensim
|
12 |
import gensim.corpora as corpora
|
13 |
from gensim.corpora import Dictionary
|
@@ -39,20 +40,33 @@ import time
|
|
39 |
|
40 |
#===config===
|
41 |
st.set_page_config(
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
45 |
)
|
46 |
-
|
47 |
hide_streamlit_style = """
|
48 |
<style>
|
49 |
-
#MainMenu
|
|
|
50 |
footer {visibility: hidden;}
|
|
|
51 |
</style>
|
52 |
"""
|
53 |
-
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
st.
|
|
|
56 |
|
57 |
#========unique id========
|
58 |
@st.cache_resource(ttl=3600)
|
@@ -104,7 +118,7 @@ def conv_txt(extype):
|
|
104 |
|
105 |
|
106 |
#===Read data===
|
107 |
-
uploaded_file = st.file_uploader(
|
108 |
|
109 |
if uploaded_file is not None:
|
110 |
extype = get_ext(uploaded_file)
|
@@ -187,13 +201,12 @@ if uploaded_file is not None:
|
|
187 |
["all-MiniLM-L6-v2", "paraphrase-multilingual-MiniLM-L12-v2", "en_core_web_md"], index=0, horizontal=True)
|
188 |
else:
|
189 |
st.write('Please choose your preferred method')
|
190 |
-
|
191 |
-
if method == 'BERTopic':
|
192 |
-
st.info('BERTopic is an expensive process when dealing with a large volume of text with our existing resources. Please kindly wait until the visualization appears.', icon="ℹ️")
|
193 |
-
|
194 |
if st.button("Submit", on_click=reset_all):
|
195 |
num_topic = num_cho
|
196 |
-
|
|
|
|
|
|
|
197 |
#===topic===
|
198 |
if method == 'Choose...':
|
199 |
st.write('')
|
|
|
8 |
from nltk.stem import WordNetLemmatizer
|
9 |
nltk.download('stopwords')
|
10 |
from nltk.corpus import stopwords
|
11 |
+
#from scipy import triu
|
12 |
import gensim
|
13 |
import gensim.corpora as corpora
|
14 |
from gensim.corpora import Dictionary
|
|
|
40 |
|
41 |
#===config===
|
42 |
st.set_page_config(
|
43 |
+
page_title="Coconut",
|
44 |
+
page_icon="🥥",
|
45 |
+
layout="wide",
|
46 |
+
initial_sidebar_state="collapsed"
|
47 |
)
|
48 |
+
|
49 |
hide_streamlit_style = """
|
50 |
<style>
|
51 |
+
#MainMenu
|
52 |
+
{visibility: hidden;}
|
53 |
footer {visibility: hidden;}
|
54 |
+
[data-testid="collapsedControl"] {display: none}
|
55 |
</style>
|
56 |
"""
|
57 |
+
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
|
58 |
+
|
59 |
+
with st.popover("🔗 Menu"):
|
60 |
+
st.page_link("Home.py", label="Home", icon="🏠")
|
61 |
+
st.page_link("pages/1 Scattertext.py", label="Scattertext", icon="1️⃣")
|
62 |
+
st.page_link("pages/2 Topic Modeling.py", label="Topic Modeling", icon="2️⃣")
|
63 |
+
st.page_link("pages/3 Bidirected Network.py", label="Bidirected Network", icon="3️⃣")
|
64 |
+
st.page_link("pages/4 Sunburst.py", label="Sunburst", icon="4️⃣")
|
65 |
+
st.page_link("pages/5 Burst Detection.py", label="Burst Detection", icon="5️⃣")
|
66 |
+
st.page_link("pages/6 Keywords Stem.py", label="Keywords Stem", icon="6️⃣")
|
67 |
|
68 |
+
st.header("Topic Modeling", anchor=False)
|
69 |
+
st.subheader('Put your file here...', anchor=False)
|
70 |
|
71 |
#========unique id========
|
72 |
@st.cache_resource(ttl=3600)
|
|
|
118 |
|
119 |
|
120 |
#===Read data===
|
121 |
+
uploaded_file = st.file_uploader('', type=['csv', 'txt'], on_change=reset_all)
|
122 |
|
123 |
if uploaded_file is not None:
|
124 |
extype = get_ext(uploaded_file)
|
|
|
201 |
["all-MiniLM-L6-v2", "paraphrase-multilingual-MiniLM-L12-v2", "en_core_web_md"], index=0, horizontal=True)
|
202 |
else:
|
203 |
st.write('Please choose your preferred method')
|
|
|
|
|
|
|
|
|
204 |
if st.button("Submit", on_click=reset_all):
|
205 |
num_topic = num_cho
|
206 |
+
|
207 |
+
if method == 'BERTopic':
|
208 |
+
st.info('BERTopic is an expensive process when dealing with a large volume of text with our existing resources. Please kindly wait until the visualization appears.', icon="ℹ️")
|
209 |
+
|
210 |
#===topic===
|
211 |
if method == 'Choose...':
|
212 |
st.write('')
|