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
Create main.py
Browse files
main.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from prediction import predict_class
|
| 2 |
+
import tensorflow as tf
|
| 3 |
+
|
| 4 |
+
# Cargar el modelo
|
| 5 |
+
new_model = tf.keras.models.load_model('fruits_detection.keras')
|
| 6 |
+
|
| 7 |
+
# Funci贸n para manejar la solicitud de predicci贸n
|
| 8 |
+
def predict_image(image_path):
|
| 9 |
+
predicted_class = predict_class(new_model, image_path)
|
| 10 |
+
return {"predicted_class": predicted_class}
|