heinini2 commited on
Commit
ff65092
·
verified ·
1 Parent(s): 0952744

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -4,10 +4,10 @@ from tensorflow.keras.preprocessing.image import img_to_array, load_img
4
  import numpy as np
5
 
6
  # Modell laden
7
- model = load_model('pokemon-model.keras')
8
 
9
  def classify_image(image):
10
- image = image.resize((224, 224)) # passende Größe für das Modell
11
  image = img_to_array(image) # Bild in Array umwandeln
12
  image = np.expand_dims(image, axis=0) # Dimension hinzufügen
13
  image /= 255.0 # Normalisierung
@@ -17,9 +17,9 @@ def classify_image(image):
17
  return {classes[i]: float(prediction[0][i]) for i in range(4)} # Wahrscheinlichkeiten zurückgeben
18
 
19
  iface = gr.Interface(
20
- classify_image,
21
- gr.inputs.Image(shape=(224, 224)),
22
- gr.outputs.Label(num_top_classes=4),
23
  title="Pokémon Classifier",
24
  description="Upload an image of a Pokémon and see the model classify it!"
25
  )
 
4
  import numpy as np
5
 
6
  # Modell laden
7
+ model = load_model('path/to/your/model.keras')
8
 
9
  def classify_image(image):
10
+ image = image.resize((224, 224)) # Bild auf passende Größe bringen
11
  image = img_to_array(image) # Bild in Array umwandeln
12
  image = np.expand_dims(image, axis=0) # Dimension hinzufügen
13
  image /= 255.0 # Normalisierung
 
17
  return {classes[i]: float(prediction[0][i]) for i in range(4)} # Wahrscheinlichkeiten zurückgeben
18
 
19
  iface = gr.Interface(
20
+ fn=classify_image,
21
+ inputs=gr.inputs.Image(shape=(224, 224)),
22
+ outputs=gr.outputs.Label(num_top_classes=4),
23
  title="Pokémon Classifier",
24
  description="Upload an image of a Pokémon and see the model classify it!"
25
  )