Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sklearn.decomposition import NMF
|
2 |
+
from sklearn.feature_extraction.text import CountVectorizer
|
3 |
+
from sklearn.pipeline import Pipeline
|
4 |
+
|
5 |
+
bow_vectorizer = CountVectorizer()
|
6 |
+
nmf = NMF(n_components=10)
|
7 |
+
topic_pipeline = Pipeline(
|
8 |
+
[
|
9 |
+
("bow", bow_vectorizer),
|
10 |
+
("nmf", nmf),
|
11 |
+
]
|
12 |
+
)
|
13 |
+
topic_pipeline.fit(texts)
|
14 |
+
|
15 |
+
import topicwizard
|
16 |
+
|
17 |
+
topicwizard.visualize(pipeline=topic_pipeline, corpus=texts)
|
18 |
+
|