mahmoud-hussein16 commited on
Commit
385e603
·
verified ·
1 Parent(s): 6c17ba2

Create app

Browse files
Files changed (1) hide show
  1. app +22 -0
app ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import joblib
3
+
4
+ # Load the pre-trained model (Pipeline with vectorizer and classifier)
5
+ model = joblib.load('text_classification_pipeline.pkl')
6
+
7
+ # Title of the Streamlit app
8
+ st.title("Tweet Sentiment Classifier")
9
+
10
+ # Input text area for user to enter a tweet
11
+ tweet = st.text_area("Enter the tweet")
12
+
13
+ # Button for triggering the prediction
14
+ if st.button("Predict Sentiment"):
15
+ if tweet:
16
+ # Use the model to predict the sentiment of the tweet
17
+ prediction = model.predict([tweet])
18
+
19
+ # Display the prediction
20
+ st.write(f"Predicted Sentiment Label: {prediction[0]}")
21
+ else:
22
+ st.write("Please enter a tweet to classify.")