Sentiment / app.py
Daniton's picture
Update app.py
08ad2b4
raw
history blame contribute delete
538 Bytes
import gradio as gr
import pickle
#from PIL import Image
def predict_sentiment(sentence):
sentimate_model = pickle.load(open("model (1).pkl", 'rb'))
import tensorflow as tf
pred_prob = sentimate_model.predict([sentence])
pred_label = tf.squeeze(tf.round(pred_prob)).numpy()
if pred_label > 0:
return 'Positive'
else:
return 'Negative'
gr.Interface(predict_sentiment, inputs=gr.inputs.Textbox(lines=1, label='Enter your Review'), outputs=gr.outputs.Textbox(label='Sentiment Analysis')).launch()