jamesd22's picture
fix one example filename
c15b415
import gradio as gr
from fastai.vision.all import *
import skimage
learn = load_learner('export.pkl')
labels = learn.dls.vocab
def predict(img):
img = PILImage.create(img)
pred, pred_idx, probs = learn.predict(img)
return {label : float(probs[i]) for (i, label) in enumerate(labels)}
title = "Currawong vs Magpie Classifier"
description = "Distinguish between two often-confused birds - the Magpie and the Currawong"
examples = ['magpie.jpg', 'currawong.jfif']
gr.Interface(
title=title,
description=description,
examples=examples,
interpretation='default',
enable_queue=True,
fn=predict,
inputs=gr.inputs.Image(shape=(256,256)),
outputs=gr.outputs.Label(num_top_classes=2)
).launch()