#!/usr/bin/env python # coding: utf-8 # In[1]: import gradio as gr from fastai.vision.all import load_learner # In[33]: # In[4]: learner = load_learner("export.pkl") # In[46]: categories = ["black", "grizzly", "teddy"] def image_classifier(img): pred, idx, probs = learner.predict(img) return dict(zip(categories, map(float, probs))) # In[47]: # In[48]: intf = gr.Interface( fn=image_classifier, inputs="image", outputs="label", examples=["black.jpg", "grizzly.jpg", "teddy.jpg"], ) intf.launch() # ## Export # In[ ]: