Spaces:
Runtime error
Runtime error
| from fastai.vision.all import * | |
| import gradio as gr | |
| learner = load_learner('model.pkl') | |
| im = PILImage.create('teddy_bear.jpg') | |
| print(learner.predict(im)) | |
| categories = ['grizzly', 'black', 'teddy'] | |
| def classify_img(img): | |
| pred, idx, probs = learner.predict(img) | |
| return dict(zip(categories,map(float,probs))) | |
| image = gr.inputs.Image(shape=(512,512)) | |
| label = gr.outputs.Label() | |
| examples = ['teddy_bear.jpg'] | |
| intf = gr.Interface(fn=classify_img, inputs=image, outputs=label,examples=examples) | |
| intf.launch(inline=False) | |