Spaces:
Runtime error
Runtime error
Download app.py from bijaykn7/catIdentifier: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/bijaykn7/catIdentifier/resolve/main/app.py
- Command line
-
hf download hf://spaces/bijaykn7/catIdentifier/app.py
-
curl -L -o app.py https://huggingface.co/spaces/bijaykn7/catIdentifier/resolve/main/app.py
549 Bytes
| import gradio as gr | |
| from fastai.vision.all import * | |
| def is_cat(x): return x[0].isUpper() | |
| learn = load_learner('carOrNotModel.pkl') | |
| categories = ('dog','cat') | |
| def classify_images(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories,map(float,probs))) | |
| image = gr.Image(height=192, width=192) | |
| label = gr.Label() | |
| examples = ['dog.png','cat.jpeg','dunno.jpg'] | |
| intf = gr.Interface(fn=classify_images, inputs = image, outputs=label, examples=examples) | |
| # code that starts the ui with url: | |
| intf.launch(inline=False, share=false) | |