import gradio as gr from fastai.vision.all import * import skimage def is_cat(x): return x[0].isupper() learn = load_learner('export.pkl') labels = learn.dls.vocab def predict(img): img = PILImage.create(img) pred,pred_idx,probs = learn.predict(img) return {labels[i]: float(probs[i]) for i in range(len(labels))} title = "Mi detector de gatos / My Cat Detector" description = "Un modelo de prueba para aprender, siguiendo las instrucciones de la lección 2 del curso de fast.ai. El modelo detecta si la foto es de uno de mis dos gatos. / A test model to learn, following the instructions in lesson 2 of the fast.ai course. The model detects if the picture is one of my two cats." article="

Artículo en PapaGameDev

PapaGameDev Blog Post

" examples = ['ori.jpg'] interpretation='default' enable_queue=True gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()