imanolcb commited on
Commit
3bf3105
·
verified ·
1 Parent(s): e45cd68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -1,17 +1,22 @@
1
  import gradio as gr
2
- import tensorflow as tf
3
-
4
  import os
5
  os.environ["KERAS_BACKEND"] = "jax"
6
 
7
  import keras
8
 
9
- # Cargar el modelo desde Hugging Face
10
- model = tf.keras.models.load_model(
11
- "hf://imanolcb/basicFruitClassifier", # solo el repo
12
- file_name="modelo_frutas_transfer.keras" # nombre del archivo dentro del repo
 
 
 
 
13
  )
14
 
 
 
 
15
 
16
  # Preprocesamiento de las imágenes de entrada
17
  def preprocess_image(image):
 
1
  import gradio as gr
 
 
2
  import os
3
  os.environ["KERAS_BACKEND"] = "jax"
4
 
5
  import keras
6
 
7
+ from huggingface_hub import hf_hub_download
8
+ import tensorflow as tf
9
+
10
+ # Descargar el modelo .keras desde Hugging Face
11
+ model_path = hf_hub_download(
12
+ repo_id="imanolcb/basicFruitClassifier",
13
+ filename="modelo_frutas_transfer.keras",
14
+ repo_type="model"
15
  )
16
 
17
+ # Cargar el modelo localmente
18
+ model = tf.keras.models.load_model(model_path)
19
+
20
 
21
  # Preprocesamiento de las imágenes de entrada
22
  def preprocess_image(image):