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()