from fastai.vision.all import * import gradio as gr learn = load_learner('model.pkl') categories = ('Doutor Eggman', 'Sonic the Hedgehog') def predict(img): pred,pred_idx,probs = learn.predict(img) return dict(zip(categories, map(float, probs))) image = gr.Image() label = gr.Label() examples = ['sonic.jpg', 'eggman.jpg'] iface = gr.Interface(fn=predict, inputs=image, outputs=label, examples=examples) iface.launch(inline=False)