Spaces:
Runtime error
Runtime error
Download app.py from AlGouvea/Type_Tester: direct link, hf CLI and curl.
- Browser
- Download file 719 Bytes
-
https://huggingface.co/spaces/AlGouvea/Type_Tester/resolve/main/app.py
- Command line
-
hf download hf://spaces/AlGouvea/Type_Tester/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AlGouvea/Type_Tester/resolve/main/app.py
719 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner('PokeModel.pkl') | |
| categories = ('Bug','Dark','Dragon','Electric','Fairy','Fighting','Fire','Flying','Ghost','Grass','Ground','Ice','Normal','Poison','Psychic','Rock','Steel','Water') | |
| def classify_image(img): | |
| _, _, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image() | |
| label = gr.outputs.Label() | |
| examples = ['Alcremie.jpg', 'Treecko.png', 'Aegislash.png', 'Mudbray.png', 'Lycanroc.png', 'Oricorio.png', 'Boltund.png', 'Meowstic.png', 'Marowak.png', 'Vaporeon.png' ] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) |