Spaces:
Runtime error
Runtime error
Download app.py from AlGouvea/ML_Entrega_2: direct link, hf CLI and curl.
- Browser
- Download file 498 Bytes
-
https://huggingface.co/spaces/AlGouvea/ML_Entrega_2/resolve/main/app.py
- Command line
-
hf download hf://spaces/AlGouvea/ML_Entrega_2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AlGouvea/ML_Entrega_2/resolve/main/app.py
498 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| learn = load_learner('instruments_model.pkl') | |
| categories = ('cavaquinho', 'guitar', 'violin') | |
| def classify_image(img): | |
| _, _, probs = learn.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image() | |
| label = gr.outputs.Label() | |
| examples = ['violin.jpg', 'guitar.jpg', 'cavaquinho.jpg'] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) |