from fastai.vision.all import * import gradio as gr categories = ('black', 'grizzly', 'teddy') def classify_image(img): pred, idx, probs = learn.predict(img) return dict(zip(categories, map(float, probs))) def greet(name): return "Hello " + name + "!!" # gr.Interface(fn=greet, inputs="text", outputs="text").launch learn = load_learner('model/bears.pkl') image = gr.inputs.Image(shape=(192, 192)) label = gr.outputs.Label() examples = ['images/black.jpg', 'images/grizzly.jpg', 'images/teddy.jpg'] intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) intf.launch(inline=False) # m = learn.model # ps = list(m.parameters()) # ps[1]