Spaces:
Build error
Build error
Download app.py from leftbyte/sweetOrSavory: direct link, hf CLI and curl.
- Browser
- Download file 453 Bytes
-
https://huggingface.co/spaces/leftbyte/sweetOrSavory/resolve/main/app.py
- Command line
-
hf download hf://spaces/leftbyte/sweetOrSavory/app.py
-
curl -L -o app.py https://huggingface.co/spaces/leftbyte/sweetOrSavory/resolve/main/app.py
453 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| def classify_image(img): | |
| pred, idx, probs = model.predict(img) | |
| return dict(zip(model.dls.vocab, map(float, probs))) | |
| model = load_learner('model/foods.pkl') | |
| image = gr.inputs.Image(shape=(224, 224)) | |
| label = gr.outputs.Label() | |
| examples = ['images/cake.jpg', 'images/pizza.jpg'] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) | |