File size: 675 Bytes
385e603
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
import joblib

# Load the pre-trained model (Pipeline with vectorizer and classifier)
model = joblib.load('text_classification_pipeline.pkl')

# Title of the Streamlit app
st.title("Tweet Sentiment Classifier")

# Input text area for user to enter a tweet
tweet = st.text_area("Enter the tweet")

# Button for triggering the prediction
if st.button("Predict Sentiment"):
    if tweet:
        # Use the model to predict the sentiment of the tweet
        prediction = model.predict([tweet])

        # Display the prediction
        st.write(f"Predicted Sentiment Label: {prediction[0]}")
    else:
        st.write("Please enter a tweet to classify.")