import streamlit as st from utils.topically import make_topics st.set_page_config(layout="wide") DATA_OPTIONS = { 'Beauty': 'All_Beauty', 'Appliances': 'Appliances', 'Baby Products': 'Baby_Products', 'Electronics': 'Electronics', 'Health and Household': 'Health_and_Household', 'Movies and TV': 'Movies_and_TV' } st.markdown("# Topic Modeling") cat = st.sidebar.selectbox( "Choose the dataset to model", tuple(DATA_OPTIONS.keys()), index=None ) column = st.sidebar.selectbox("Choose a column to model", ("Text", "Title", "Both"), index=None) if cat and column: category = DATA_OPTIONS[cat] topic_pipeline, fig = make_topics( category=category, topic_columns=column, lemmatize=True, # or False n1=2, n2=3, n_components=5, rating=[1, 2], # optional helpful_vote=0, # optional new_words=None, n_top_words=5, # data_dir="path/to/review_data" # optional override if needed ) st.plotly_chart(fig, use_container_width=True, config={"scrollZoom": True})