Spaces:
No application file
No application file
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.") |