Spaces:
No application file
No application file
import gradio as gr | |
import pickle | |
# Cargar el modelo desde un archivo | |
with open('modelo_recomendacion.pkl', 'rb') as archivo: | |
model = pickle.load(archivo) | |
def get_predictions(userId, id): | |
predictions = model.predict(userId, id) | |
if predictions.est >= 4: | |
mensaje = "Muy recomendada" | |
elif predictions.est >= 3 and predictions.est < 4: | |
mensaje = "Recomendada" | |
else: | |
mensaje = f"No te la recomiendo ({predictions.est:.2f})" | |
return mensaje | |
inputs = [ | |
gr.inputs.Textbox(label="User ID"), | |
gr.inputs.Textbox(label="ID"), | |
] | |
output = gr.outputs.Textbox(label="Predicci贸n") | |
iface = gr.Interface(fn=get_predictions, inputs=inputs, outputs=output, title="Predicci贸n de recomendaci贸n de pel铆culas") | |
iface.launch(share=True) | |