| | from huggingface_hub import from_pretrained_fastai |
| | import gradio as gr |
| | from fastai.vision.all import * |
| |
|
| | repo_id = "paascorb/practica7modelo" |
| |
|
| | learner = from_pretrained_fastai(repo_id) |
| | labels = ["malo", "medio", "bueno"] |
| |
|
| | |
| | def predict(chiste): |
| | pred,pred_idx,probs = learner.predict(chiste) |
| | return {labels[i]: float(probs[i]) for i in range(len(labels))} |
| | |
| | |
| | gr.Interface(fn=predict, inputs=gr.Textbox(lines=2, placeholder="Escriba su chiste aquí..."), outputs=gr.outputs.Label(num_top_classes=3), examples=['Van dos y se cae el del medio.']).launch(share=False) |
| |
|