Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pickle
|
3 |
+
#from PIL import Image
|
4 |
+
|
5 |
+
def predict_sentiment(sentence):
|
6 |
+
sentimate_model = pickle.load(open("model (1).pkl", 'rb'))
|
7 |
+
import tensorflow as tf
|
8 |
+
pred_prob = sentimate_model.predict([sentence])
|
9 |
+
pred_label = tf.squeeze(tf.round(pred_prob)).numpy()
|
10 |
+
if pred_label > 0:
|
11 |
+
return 'Positive'
|
12 |
+
else:
|
13 |
+
return 'Negative'
|
14 |
+
|
15 |
+
gr.Interface(predict_sentiment, inputs=gr.inputs.Textbox(lines=1, label='Enter your Review')).launch()
|
16 |
+
|
17 |
+
|
18 |
+
|