Spaces:
Runtime error
Runtime error
Download app.py from gnart/cloud-classifier: direct link, hf CLI and curl.
- Browser
- Download file 552 Bytes
-
https://huggingface.co/spaces/gnart/cloud-classifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/gnart/cloud-classifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/gnart/cloud-classifier/resolve/main/app.py
552 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| import timm | |
| learn = load_learner("model.pkl") | |
| categories = learn.dls.vocab | |
| def classify_image(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image(shape=(192, 192)) | |
| label = gr.outputs.Label() | |
| examples = [ | |
| "example_photos/altocumulus.jpg", | |
| "example_photos/lenticular.jpg", | |
| "example_photos/cirrocumulus.jpg", | |
| ] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch() | |