jeysshon commited on
Commit
2772f38
·
verified ·
1 Parent(s): 0c23147

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -36,8 +36,9 @@ labels = [
36
  ]
37
 
38
  def classify_image(image):
 
39
  image = tf.image.resize(image, (224, 224))
40
- image = tf.expand_dims(image, axis=0)
41
  prediction = model.predict(image).flatten()
42
  confidences = {labels[i]: float(prediction[i]) for i in range(len(labels))}
43
  return confidences
@@ -97,7 +98,8 @@ gr.Interface(
97
  title=title,
98
  article=article,
99
  description=description,
100
- inputs=gr.Image(shape=(224, 224)),
101
  outputs=gr.Label(num_top_classes=4),
102
  examples=examples
103
  ).launch()
 
 
36
  ]
37
 
38
  def classify_image(image):
39
+ # Redimensionar la imagen a (224, 224) antes de la predicción
40
  image = tf.image.resize(image, (224, 224))
41
+ image = tf.expand_dims(image, axis=0) # Añadir una dimensión para el batch
42
  prediction = model.predict(image).flatten()
43
  confidences = {labels[i]: float(prediction[i]) for i in range(len(labels))}
44
  return confidences
 
98
  title=title,
99
  article=article,
100
  description=description,
101
+ inputs=gr.Image(),
102
  outputs=gr.Label(num_top_classes=4),
103
  examples=examples
104
  ).launch()
105
+