Image Classification
TF-Keras
English
computer-vision
agriculture
maize-diseases
agroeye
eligapris
grey
Instructions to use eligapris/agroeye with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use eligapris/agroeye with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy) # See https://github.com/keras-team/tf-keras for more details. from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("eligapris/agroeye") - Notebooks
- Google Colab
- Kaggle
| # TF for image classification model | |
| import tensorflow | |
| import numpy | |
| from PIL import Image | |
| model = tensorflow.saved_model.load('./') | |
| classes = [ "Northern_Leaf_Blight" , "Gray_Leaf_Spot" , "Healthy_Leaf" , "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()]) |