# AUTOGENERATED! DO NOT EDIT! File to edit: ../testing.ipynb. # %% auto 0 __all__ = ['learn', 'categories', 'examples', 'intf', 'classify_img'] # %% ../testing.ipynb 1 from fastai.vision.all import * import gradio as gr # %% ../testing.ipynb 3 learn = load_learner("model.pkl") # %% ../testing.ipynb 5 categories = ('American Robin', 'Downy Woodpecker', 'Great Blue Heron', 'Hairy Woodpecker', 'House Sparrow') def classify_img(img): pred,idx,probs = learn.predict(img) return dict(zip(categories, map(float,probs))) # %% ../testing.ipynb 7 # image = gr.Image(shape=(256,256)) # label = gr.Label() examples = ['american_robin.jpeg', 'downy_woodpecker.jpeg', 'great_blue_heron.jpeg', 'hairy_woodpecker.jpeg', 'house_sparrow.jpeg'] intf = gr.Interface(fn=classify_img, inputs='image', outputs='label', examples=examples) intf.launch(inline=False)