Spaces:
Sleeping
Sleeping
| from fastai.vision.all import * | |
| import gradio as gr | |
| loaded_model = load_learner('model.pkl') | |
| categories = loaded_model.dls.vocab | |
| def classify_image(img): | |
| pred,idx,prob = loaded_model.predict(img) | |
| return dict(zip(categories, map(float, prob))) | |
| image = gr.components.Image(height=512, width=512) | |
| label = gr.components.Label() | |
| title = "Pascal Multi Label Classifier" | |
| description = "A multi label classifier trained on Pascal dataset." | |
| examples = ['multilabel_bird_on_horse.jpg'] | |
| enable_queue=True | |
| iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, title=title,description=description,examples=examples) | |
| iface.queue(max_size=3) | |
| iface.launch(inline=False) | |