Spaces:
Runtime error
Runtime error
Download app.py from SamSaver/anime-detector: direct link, hf CLI and curl.
- Browser
- Download file 546 Bytes
-
https://huggingface.co/spaces/SamSaver/anime-detector/resolve/main/app.py
- Command line
-
hf download hf://spaces/SamSaver/anime-detector/app.py
-
curl -L -o app.py https://huggingface.co/spaces/SamSaver/anime-detector/resolve/main/app.py
546 Bytes
| # |export | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| # |export | |
| learn = load_learner('export.pkl') | |
| # |export | |
| categories = learn.dls.vocab | |
| # |export | |
| def classify_image(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| # |export | |
| image = gr.inputs.Image(shape=(192, 192)) | |
| label = gr.outputs.Label() | |
| examples = ['naruto.jpg', 'ben.jpg', 'izuku.jpg'] | |
| intf = gr.Interface(fn=classify_image, inputs=image, | |
| outputs=label, examples=examples) | |
| intf.launch(inline=False) | |