Spaces:
Build error
Build error
Download app.py from Langurmonkey/firsttest: direct link, hf CLI and curl.
- Browser
- Download file 491 Bytes
-
https://huggingface.co/spaces/Langurmonkey/firsttest/resolve/main/app.py
- Command line
-
hf download hf://spaces/Langurmonkey/firsttest/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Langurmonkey/firsttest/resolve/main/app.py
491 Bytes
| import gradio as gr | |
| from fastai.vision.all import * | |
| def is_cat(x): return x[0].isupper() | |
| learn = load_learner('model.pkl') | |
| categories = ('Grizzly', 'Black', 'Teddy') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| examples = ['grizzly.jpg', 'teddy.jpg', 'dunno.jpg'] | |
| intf = gr.Interface( | |
| fn=classify_image, | |
| inputs=gr.Image(height=192, width=192), | |
| outputs=gr.Label(), | |
| examples=examples | |
| ) | |
| intf.launch() | |