proyecto / app.py
Rolajim's picture
Update app.py
45650be
raw
history blame contribute delete
No virus
821 Bytes
import gradio as gr
import surprise
from surprise import dump
file_name = 'modelo_entrenado.sav'
model = dump.load(file_name)[1]
def predict_rating(userId, id):
prediction = model.predict(userId, id)
if prediction.est >= 3.5:
mensaje = "Es hora de verla!!", prediction.est
elif prediction.est >= 2.5 and prediction.est < 3.5:
mensaje = "Puedes verla luego!", prediction.est
else:
mensaje = "No es la película que esta buscando!", prediction.est
return mensaje
iface = gr.Interface(fn=predict_rating,
inputs= [gr.inputs.Textbox(lines=1,placeholder="ingrese su número de usuario aquí"),
gr.inputs.Textbox(lines=1,placeholder="ingrese su número de usuario aquí")],
outputs="text")
iface.launch()