Spaces:
Runtime error
Runtime error
Download app.py from Ahnnet/Fastfood_classification: direct link, hf CLI and curl.
- Browser
- Download file 701 Bytes
-
https://huggingface.co/spaces/Ahnnet/Fastfood_classification/resolve/main/app.py
- Command line
-
hf download hf://spaces/Ahnnet/Fastfood_classification/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Ahnnet/Fastfood_classification/resolve/main/app.py
701 Bytes
| from fastai.vision.all import * | |
| import gradio as gr | |
| def is_cat(x): return x[0].isupper() | |
| learn = load_learner('model.pkl') | |
| categories = ('Potato', 'Burger', 'Crispy Chicken', 'Donut', 'Fries', 'Hotdog', 'Pizza', 'Sandwich', 'Taco', 'Taquito') | |
| def classify_image(img): | |
| pred,idx,probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| examples = ['burger.PNG', 'pizza.PNG', 'hotdog.PNG', 'donut.PNG', 'pizzaCountry, Chicken princess.PNG', 'fakePizza.PNG', 'fakeChicken.PNG', 'fakeHotdog.PNG'] | |
| intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) |