Instructions to use eligapris/maize-diseases-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use eligapris/maize-diseases-detection with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy), and from_pretrained_keras was removed in huggingface_hub 1.0. # See https://github.com/keras-team/tf-keras for more details. # !pip install "huggingface_hub<1.0" tf_keras from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("eligapris/maize-diseases-detection") - Notebooks
- Google Colab
- Kaggle
Download example.py from eligapris/maize-diseases-detection: direct link, hf CLI and curl.
- Browser
- Download file 556 Bytes
-
https://huggingface.co/eligapris/maize-diseases-detection/resolve/main/example.py
- Command line
-
hf download hf://eligapris/maize-diseases-detection/example.py
-
curl -L -o example.py https://huggingface.co/eligapris/maize-diseases-detection/resolve/main/example.py
556 Bytes
| # TF for image classification model | |
| import tensorflow | |
| import numpy | |
| from PIL import Image | |
| model = tensorflow.saved_model.load('./') | |
| classes = [ "Healthy" , "Gray_Leaf_Spot" , "Blight" , "Common_Rust" , ] | |
| img = Image.open("image.jpg").convert('RGB') | |
| img = img.resize((300, 300 * img.size[1] // img.size[0]), Image.ANTIALIAS) | |
| inp_numpy = numpy.array(img)[None] | |
| inp = tensorflow.constant(inp_numpy, dtype='float32') | |
| class_scores = model(inp)[0].numpy() | |
| print("") | |
| print("class_scores", class_scores) | |
| print("Class : ", classes[class_scores.argmax()]) |