import gradio as gr from fastai.vision.all import * learn = load_learner('model_beeOrWasp.pkl') labels = ('Bee', 'Wasp') def predict(img): pred, pred_idx, prob = learn.predict(img) return dict(zip(labels, map(float, prob))) title="Bee or wasp classifier" image = gr.inputs.Image(shape=(192,192)) label = gr.outputs.Label() examples = ['bee.jpg', 'wasp.jpg'] intf = gr.Interface(fn=predict,inputs=image,outputs=label) intf.launch(inline=False, share=True)