File size: 1,265 Bytes
dfe1c24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766ce94
dfe1c24
 
 
 
 
 
a884e80
 
dfe1c24
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
from wordcloud import WordCloud

# Function to analyze sentiment
def analyze_sentiment(text):
    # Placeholder function for sentiment analysis
    # Replace with actual sentiment analysis logic
    return "Positive" if "good" in text else "Negative"

# Function to generate word cloud
def generate_wordcloud(text):
    wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text)
    return wordcloud

# Streamlit app
st.title("NFL Draft Sentiment Analysis")

uploaded_file = st.file_uploader("Upload a text file", type=["csv"])

if uploaded_file is not None:
    # Read the file content
    file_content = uploaded_file.read().decode("utf-8")
    
    # Display the file content
    # st.subheader("File Content")
    # st.text(file_content)
    
    # Analyze sentiment
    sentiment = analyze_sentiment(file_content)
    st.subheader("Sentiment Analysis")
    st.write(f"The sentiment of the text is: {sentiment}")
    
    # Generate and display word cloud
    wordcloud = generate_wordcloud(file_content)
    st.subheader("Word Cloud")
    plt.figure(figsize=(10, 5))
    plt.imshow(wordcloud, interpolation='bilinear')
    plt.axis("off")
    st.pyplot(plt)