Spaces:
Sleeping
Sleeping
Download app.py from Mindofmachine/my_first_space: direct link, hf CLI and curl.
- Browser
- Download file 689 Bytes
-
https://huggingface.co/spaces/Mindofmachine/my_first_space/resolve/main/app.py
- Command line
-
hf download hf://spaces/Mindofmachine/my_first_space/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Mindofmachine/my_first_space/resolve/main/app.py
689 Bytes
| """import gradio as gr | |
| def greet(name): | |
| return "Hello " + name + "!!" | |
| iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| iface.launch()""" | |
| #|export | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| #|export | |
| learn = load_learner("export.pkl") | |
| #|export | |
| def classify_image(img): | |
| predict, idx, probs = learn.predict(img) | |
| categories = learn.dls.vocab | |
| return dict(zip(categories,map(float,probs))) | |
| #|export | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| examples = ["sunflower.jpg","Peonies.jpeg","Hellebore.jpg","Rose.jpg"] | |
| intf = gr.Interface(fn=classify_image, inputs=image,outputs=label,examples=examples) | |
| intf.launch(inline=False) | |