sprinala commited on
Commit
6009c34
·
verified ·
1 Parent(s): b7eec1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -10,6 +10,7 @@ model = tf.keras.models.load_model('pokemon_model.keras')
10
  class_names = ['Jolteon', 'Kakuna', 'Mr. Mime']
11
 
12
  def classify_image(image):
 
13
  img = image.resize((160, 160))
14
  img_array = tf.keras.preprocessing.image.img_to_array(img)
15
  img_array = tf.expand_dims(img_array, 0) # Erstelle einen Batch
@@ -18,8 +19,9 @@ def classify_image(image):
18
  confidence = np.max(predictions[0])
19
  return predicted_class, confidence
20
 
21
- image_input = gr.Image(shape=(160, 160))
22
- label = gr.Label(num_top_classes=3)
 
23
 
24
  iface = gr.Interface(
25
  fn=classify_image,
 
10
  class_names = ['Jolteon', 'Kakuna', 'Mr. Mime']
11
 
12
  def classify_image(image):
13
+ image = Image.fromarray(image.astype('uint8'), 'RGB')
14
  img = image.resize((160, 160))
15
  img_array = tf.keras.preprocessing.image.img_to_array(img)
16
  img_array = tf.expand_dims(img_array, 0) # Erstelle einen Batch
 
19
  confidence = np.max(predictions[0])
20
  return predicted_class, confidence
21
 
22
+
23
+ image_input = gr.Image()
24
+ label = gr.Label(num_top_classes=3)
25
 
26
  iface = gr.Interface(
27
  fn=classify_image,