Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,31 @@ topic_pipeline = Pipeline(
|
|
10 |
("nmf", nmf),
|
11 |
]
|
12 |
)
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
import topicwizard
|
16 |
|
|
|
10 |
("nmf", nmf),
|
11 |
]
|
12 |
)
|
13 |
+
|
14 |
+
st.subheader("Topic Modeling with Topic-Wizard")
|
15 |
+
uploaded_file = st.file_uploader("choose a text file", type=["txt"])
|
16 |
+
if uploaded_file is not None:
|
17 |
+
st.session_state["text"] = uploaded_file.getvalue().decode('utf-8')
|
18 |
+
|
19 |
+
st.write("OR")
|
20 |
+
|
21 |
+
input_text = st.text_area(
|
22 |
+
label="Enter text separated by newlines",
|
23 |
+
value="",
|
24 |
+
key="text",
|
25 |
+
height=150
|
26 |
+
)
|
27 |
+
|
28 |
+
button=st.button('Get Segments')
|
29 |
+
if (button==True) and input_text != "":
|
30 |
+
texts = input_text.split('\n')
|
31 |
+
sents = []
|
32 |
+
for text in texts:
|
33 |
+
doc = nlp(text)
|
34 |
+
for sent in doc.sents:
|
35 |
+
sents.append(sent)
|
36 |
+
|
37 |
+
topic_pipeline.fit(st.session_state["text"])
|
38 |
|
39 |
import topicwizard
|
40 |
|