codescv/pets
0
1# AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).2 3__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']4 5# Cell6from fastai.vision.all import *7import gradio as gr8import timm9 10# Cell11learn = load_learner('model.pkl')12 13# Cell14categories = learn.dls.vocab15 16def classify_image(img):17 pred,idx,probs = learn.predict(img)18 return dict(zip(categories, map(float,probs)))19 20# Cell21image = gr.inputs.Image(shape=(192, 192))22label = gr.outputs.Label()23examples = ['basset.jpg']24 25# Cell26intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)27intf.launch()