NutriTopic3 / app.py
evegarcianz's picture
updating port
e330878 verified
raw
history blame contribute delete
657 Bytes
import pandas as pd
import topicwizard
from sklearn.decomposition import NMF
from topicwizard.pipeline import make_topic_pipeline
from sklearn.feature_extraction.text import CountVectorizer
df = pd.read_csv('df_merged.csv')
abstracts=df['description'].tolist()
vectorizer = CountVectorizer(min_df=5, max_df=0.8, stop_words="english")
model = NMF(n_components=10)
topic_pipeline = make_topic_pipeline(vectorizer, model)
topic_pipeline.fit(abstracts)
topicwizard.visualize(abstracts, pipeline=topic_pipeline)
app = topicwizard.get_dash_app(vectorizer, model, corpus=abstracts)
# main.py
if __name__ == "__main__":
app.run_server(debug=False, port=7860)