#__all__=['learn','categories','classify_image','image','label','examples','iface'] import gradio as gr from fastai import * #load_learner is in here #widget suppressed from fastai.vision.all import * learn=load_learner('export.pkl') categories=('Black','Grizzly','Teddy') def classify_image(img): pred,idx,probs=learn.predict(img) #map needed because output (tensor) is not handled by gradio return dict(zip(categories,map(float,probs))) image=gr.inputs.Image(shape=(224,224)) label = gr.outputs.Label() examples=['black.jpg','grizzly.jpg','teddy.jpg'] iface=gr.Interface(fn=classify_image,inputs=image,outputs=label,example=examples) iface.launch() #Can be autogenerated from cells preceded by #|export # Using #|default_exp #from nbdev.export import notebook2script #notebook2script('notebookname.ipynb')