import gradio as gr from fastai.vision.all import * title = "Grizzly/Black/Teddy bear classifier." learn = load_learner('export.pkl') labels = learn.dls.vocab def classify_image(img): pred, idx, probs = learn.predict(img) return {labels[i]: float(probs[i]) for i in range(len(labels))} gr.HTML(title) image = gr.inputs.Image(shape=(224, 224)) label = gr.outputs.Label(num_top_classes=3) iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, title=title) iface.launch()