Spaces:
Runtime error
Runtime error
evegarcianz
commited on
Commit
•
fb448bd
1
Parent(s):
ab872f2
upload 3 files
Browse files- app.py +19 -0
- df_merged.csv +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import topicwizard
|
3 |
+
from sklearn.decomposition import NMF
|
4 |
+
from topicwizard.pipeline import make_topic_pipeline
|
5 |
+
from sklearn.feature_extraction.text import CountVectorizer
|
6 |
+
|
7 |
+
df = pd.read_csv('df_merged.csv')
|
8 |
+
abstracts=df['description'].tolist()
|
9 |
+
vectorizer = CountVectorizer(min_df=5, max_df=0.8, stop_words="english")
|
10 |
+
model = NMF(n_components=10)
|
11 |
+
topic_pipeline = make_topic_pipeline(vectorizer, model)
|
12 |
+
topic_pipeline.fit(abstracts)
|
13 |
+
topicwizard.visualize(abstracts, pipeline=topic_pipeline)
|
14 |
+
|
15 |
+
app = topicwizard.get_dash_app(vectorizer, model, corpus=abstracts)
|
16 |
+
|
17 |
+
# main.py
|
18 |
+
if __name__ == "__main__":
|
19 |
+
app.run_server(debug=False, port=8050)
|
df_merged.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
scikit-learn
|
3 |
+
topic-wizard
|