Instructions to use nico9ga/fruits-Classification-Model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use nico9ga/fruits-Classification-Model with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://nico9ga/fruits-Classification-Model") - Notebooks
- Google Colab
- Kaggle
| from tensorflow.keras.preprocessing import image | |
| import numpy as np | |
| def predict_class(model, image_path): | |
| img = image.load_img(image_path, target_size=(100, 100)) | |
| img_array = image.img_to_array(img) | |
| img_array = np.expand_dims(img_array, axis=0) | |
| predictions = model.predict(img_array) | |
| predicted_index = np.argmax(predictions[0]) | |
| classes = ['Banano', 'Durazno', 'Fresa', 'Guanabana', 'Guayaba', 'Kiwi', 'Limon', 'Lulo', 'Mandarina', 'Mango', 'Manzana', 'Manzana Verde', 'Melon', 'Mora', 'Naranja'] | |
| predicted_class = classes[predicted_index] | |
| return predicted_class |