Spaces:
Runtime error
Runtime error
Download app.py from AlGouvea/ML_Entrega3: direct link, hf CLI and curl.
- Browser
- Download file 689 Bytes
-
https://huggingface.co/spaces/AlGouvea/ML_Entrega3/resolve/main/app.py
- Command line
-
hf download hf://spaces/AlGouvea/ML_Entrega3/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AlGouvea/ML_Entrega3/resolve/main/app.py
689 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner('pokemodel.pkl') | |
| categories = ('Bulbasaur','Charmander','Chikorita','Cyndaquil','Mudkip','Squirtle','Torchic','Totodile','Treecko') | |
| def classify_image(img): | |
| _, _, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image() | |
| label = gr.outputs.Label() | |
| examples = ['Charmander.jpg', 'Squirtle.jpg', 'Bulbasaur.png', 'Chikorita.jpg', 'Cyndaquil.png', 'Totodile.jpg', 'Torchic.png', 'Mudkip.jpg', 'Treecko.png', 'Charizard.png', 'Totodile.png'] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) |