Download app.py from Hussain033/Leaf_Image_Classification: direct link, hf CLI and curl.
- Browser
- Download file 455 Bytes
-
https://huggingface.co/spaces/Hussain033/Leaf_Image_Classification/resolve/main/app.py
- Command line
-
hf download hf://spaces/Hussain033/Leaf_Image_Classification/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Hussain033/Leaf_Image_Classification/resolve/main/app.py
455 Bytes
| from predict import pre_process, predict | |
| import gradio as gr | |
| from PIL import Image | |
| def predict_main(img_path): | |
| image = Image.fromarray(img_path) | |
| image = pre_process(image) | |
| prediction = predict(image) | |
| return prediction | |
| demo = gr.Interface(fn=predict_main, | |
| inputs=gr.Image(), | |
| outputs=gr.Label(num_top_classes=3), | |
| examples=[["0008_0002.JPG"]] | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |