Spaces:
Runtime error
Runtime error
Download app.py from tindotdev/tin_prototype_01: direct link, hf CLI and curl.
- Browser
- Download file 629 Bytes
-
https://huggingface.co/spaces/tindotdev/tin_prototype_01/resolve/main/app.py
- Command line
-
hf download hf://spaces/tindotdev/tin_prototype_01/app.py
-
curl -L -o app.py https://huggingface.co/spaces/tindotdev/tin_prototype_01/resolve/main/app.py
629 Bytes
| #|export | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| #|export | |
| learn = load_learner('model.pkl') | |
| #|export | |
| def output(img): | |
| predict,index,probs = learn.predict(img) | |
| probs = torch.max(probs) | |
| return f'The picture is appear to be {predict} with probability = {probs}' | |
| #|export | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| examples = ['images/bean.jpg', 'images/tesla.jpg', 'images/Boeing.jpg', 'images/bird.jpg', 'images/boat.jpg', | |
| 'images/french.jpg','images/fat-cat.jpg'] | |
| intf = gr.Interface(fn=output, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=True) |