Spaces:
Runtime error
Runtime error
Download app.py from konieshadow/bear_classifier: direct link, hf CLI and curl.
- Browser
- Download file 825 Bytes
-
https://huggingface.co/spaces/konieshadow/bear_classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/konieshadow/bear_classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/konieshadow/bear_classifier/resolve/main/app.py
825 Bytes
| import gradio as gr | |
| from fastai.vision.all import * | |
| learn = load_learner("model.pkl") | |
| categories = learn.dls.vocab | |
| def predict(img): | |
| pred, pred_idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| title = "Bear Classifier" | |
| description = "A bear classifier trained on the images downloaded from bing serach with fastai." | |
| image = gr.inputs.Image(shape=(192, 192)) | |
| label = gr.outputs.Label() | |
| examples = ["black_bear.jpg", "brizzly_bear.jpg", "teddy_bear.jpg"] | |
| interpretation = "default" | |
| enable_queue = True | |
| itf = gr.Interface(fn=predict, | |
| inputs=image, | |
| outputs=label, | |
| title=title, | |
| examples=examples, | |
| interpretation=interpretation, | |
| enable_queue=enable_queue) | |
| itf.launch() | |