Download app.py from eiTanLaVi/Test2: direct link, hf CLI and curl.
- Browser
- Download file 584 Bytes
-
https://huggingface.co/spaces/eiTanLaVi/Test2/resolve/main/app.py
- Command line
-
hf download hf://spaces/eiTanLaVi/Test2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/eiTanLaVi/Test2/resolve/main/app.py
584 Bytes
| import gradio as gr | |
| from fastai.vision.all import * | |
| learn_inf = load_learner('export.pkl') | |
| categories = learn_inf.dls.vocab | |
| def predict(img_file): | |
| #img = PILImage.create(path) | |
| pred,idx,probs = learn_inf.predict(img_file) | |
| return dict(zip(categories, map(float,probs))) | |
| def greet(name): | |
| return "Hello " + name + "!!" | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| examples = ['images/test1.jpeg','images/test2.jpeg','images/test3.jpeg'] | |
| iface = gr.Interface(fn=predict, inputs=image, outputs=label, examples=examples) | |
| iface.launch(inline=False) |