import gradio as gr from fastai.vision.all import * learn = load_learner('owl_model.pkl') categories = ('apple cut in half', 'barn owl face') def classifier(img): pred, idx, prob = learn.predict(img) return dict(zip(categories, map(float, prob))) image = gr.inputs.Image(shape = (192, 192)) label = gr.outputs.Label() examples = ['apple.jpg', 'barn_owl.jpg'] # examples = iface = gr.Interface(fn=classifier, inputs=image, outputs=label, examples = examples) iface.launch(inline = False)