Vela
created project
726f5db
raw
history blame
847 Bytes
import streamlit as st
import data
import models
def main():
st.title("CSV Sentiment Analysis")
uploaded_file = st.file_uploader("Upload CSV or Excel file", type=["csv", "xlsx"])
classifier = models.load_model()
df = data.read_data(uploaded_file)
if uploaded_file:
column = list(df.columns)
column_with_empty = [""] + column
text_to_analyze = st.selectbox("Select text column", column_with_empty)
if text_to_analyze in df.columns:
text_column = text_to_analyze
if text_column:
df = models.analyze_sentiments(df, text_column, classifier)
data.visualize_data(df, st)
st.subheader("Processed Data Preview")
st.dataframe(df.head())
if __name__ == "__main__":
main()