-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp1.py
More file actions
22 lines (20 loc) · 783 Bytes
/
app1.py
File metadata and controls
22 lines (20 loc) · 783 Bytes
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 pandas as pd
import numpy as np
import joblib
from sklearn.naive_bayes import MultinomialNB
from PIL import Image
SAVED_MODEL_FILE = "SavedModel.sav"
#df = pd.read_csv('senti_review_file.csv')
#x = df.iloc[:,0].values # Review column as input
#y = df.iloc[:,1].values # Sentiment column as output
st.title("Sentiment Analysis On Reviews")
st.subheader('TF-IDF Vectorizer')
st.write('This project is based on Naive Bayes Classifier.')
loaded_model = joblib.load(SAVED_MODEL_FILE)
#text_model = Pipeline([('tfidf',TfidfVectorizer()),('model',MultinomialNB())])
#text_model.fit(x,y)
message = st.text_area("Enter your text below:")
out_text = loaded_model.predict([message])
if st.button("Analyze Sentiment"):
st.title(out_text)