Spaces:
Sleeping
Sleeping
| from fastai.vision.all import * | |
| import gradio as gr | |
| import skimage | |
| learn = load_learner('export.pkl') | |
| categories = ('grizzly','black','teddy') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| image = "image" | |
| label = "label" | |
| examples = ['grizzly.jpg', 'black.jpg', 'teddy.jpg'] | |
| title = "Bear Classifier" | |
| description = "A brear classifier trained on resnet18 dataset with fastai. " | |
| interpretation='default' | |
| enable_queue=True | |
| intf = gr.Interface(fn=classify_image, | |
| inputs=gr.Image(height=512, width=512), | |
| outputs=gr.Label(num_top_classes=3), | |
| title=title, | |
| description=description, | |
| examples=examples).launch() | |