Spaces:
Runtime error
Runtime error
abdulsamod
commited on
Commit
•
b28e047
1
Parent(s):
d35ea7b
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
#loading the saved model
|
6 |
+
from keras.models import load_model
|
7 |
+
model = load_model('model.h5')
|
8 |
+
|
9 |
+
import gradio as gr
|
10 |
+
|
11 |
+
def page(word):
|
12 |
+
word_tk= tokenizer.texts_to_sequences([word])
|
13 |
+
|
14 |
+
word_pad= pad_sequences(word_tk, maxlen=10)
|
15 |
+
prediction = model.predict(word_pad)
|
16 |
+
f_prediction= np.argmax(prediction)
|
17 |
+
if f_prediction == 1:
|
18 |
+
return "Authentic"
|
19 |
+
elif f_prediction ==2:
|
20 |
+
return "Normal"
|
21 |
+
elif f_prediction ==3:
|
22 |
+
return "Not Authentic"
|
23 |
+
else:
|
24 |
+
return "Error"
|
25 |
+
s
|
26 |
+
|
27 |
+
demo = gr.Interface(
|
28 |
+
fn=page,
|
29 |
+
inputs=gr.Textbox(placeholder="Enter your review and the rating to check the authenticity of any product or page"),
|
30 |
+
outputs="text",
|
31 |
+
)
|
32 |
+
|
33 |
+
demo.launch()
|