Spaces:
Runtime error
Runtime error
Download app.py from mwrites/vision_multilabel: direct link, hf CLI and curl.
- Browser
- Download file 684 Bytes
-
https://huggingface.co/spaces/mwrites/vision_multilabel/resolve/main/app.py
- Command line
-
hf download hf://spaces/mwrites/vision_multilabel/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mwrites/vision_multilabel/resolve/main/app.py
684 Bytes
| 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) | |