File size: 847 Bytes
726f5db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()