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