File size: 443 Bytes
08b5db2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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')).launch()