narinsak unawong commited on
Commit
66df8b7
·
verified ·
1 Parent(s): 3c9ded5

Upload 3 files

Browse files
Files changed (3) hide show
  1. app-sa-nb.py +18 -0
  2. requirements.txt +4 -0
  3. sentiment_pipeline.pkl +3 -0
app-sa-nb.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import streamlit as st
3
+ import pickle
4
+
5
+ # Load the model
6
+ with open('sentiment_pipeline.pkl', 'rb') as file:
7
+ loaded_model = pickle.load(file)
8
+
9
+ # Streamlit app title
10
+ st.title("Sentiment Analysis App")
11
+
12
+ # Text input for user to enter a sentence
13
+ user_input = st.text_input("Enter a sentence:")
14
+
15
+ # Predict sentiment when user inputs text
16
+ if user_input:
17
+ prediction = loaded_model.predict([user_input])[0]
18
+ st.write("Prediction:", "Positive" if prediction == 1 else "Negative")
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ pandas
2
+ scikit-learn
3
+ streamlit
4
+ numpy
sentiment_pipeline.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f687518c6577551d2d462a45e12ed30f4838e13f8da9b8db1f8abb29d2dcc82
3
+ size 4756342