Create gradio app.py
Browse files- gradio app.py +21 -0
gradio app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
def predict_rating(userId, id):
|
6 |
+
prediction = model.predict(userId, id)
|
7 |
+
|
8 |
+
if prediction.est >= 3.5:
|
9 |
+
mensaje = "Es hora de verla!!", prediction.est
|
10 |
+
elif prediction.est >= 2.5 and prediction.est < 3.5:
|
11 |
+
mensaje = "Puedes verla luego!", prediction.est
|
12 |
+
else:
|
13 |
+
mensaje = "No es la película que esta buscando!", prediction.est
|
14 |
+
|
15 |
+
return mensaje
|
16 |
+
|
17 |
+
iface = gr.Interface(fn=predict_rating,
|
18 |
+
inputs= [gr.inputs.Textbox(lines=1,placeholder="ingrese su número de usuario aquí"),
|
19 |
+
gr.inputs.Textbox(lines=1,placeholder="ingrese su número de usuario aquí")],
|
20 |
+
outputs="text")
|
21 |
+
iface.launch(inline=False)
|