Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import tensorflow as tf
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
|
6 |
-
# Laden des vortrainierten Modells
|
7 |
model_path = "kia_pokemon_keras_model.h5"
|
8 |
model = tf.keras.models.load_model(model_path)
|
9 |
|
@@ -21,6 +21,7 @@ def predict_pokemon(image):
|
|
21 |
image = image.reshape(1, 224, 224, 3)
|
22 |
|
23 |
# Vorhersage treffen
|
|
|
24 |
predictions = model.predict(image)
|
25 |
prediction = np.argmax(predictions, axis=1)[0]
|
26 |
confidence = np.max(predictions)
|
@@ -30,7 +31,7 @@ def predict_pokemon(image):
|
|
30 |
return result
|
31 |
|
32 |
# Erstellen der Gradio-Oberfläche
|
33 |
-
input_image = gr.Image(
|
34 |
output_label = gr.Label()
|
35 |
interface = gr.Interface(fn=predict_pokemon,
|
36 |
inputs=input_image,
|
|
|
3 |
from PIL import Image
|
4 |
import numpy as np
|
5 |
|
6 |
+
# Laden des vortrainierten Pokémon-Modells
|
7 |
model_path = "kia_pokemon_keras_model.h5"
|
8 |
model = tf.keras.models.load_model(model_path)
|
9 |
|
|
|
21 |
image = image.reshape(1, 224, 224, 3)
|
22 |
|
23 |
# Vorhersage treffen
|
24 |
+
|
25 |
predictions = model.predict(image)
|
26 |
prediction = np.argmax(predictions, axis=1)[0]
|
27 |
confidence = np.max(predictions)
|
|
|
31 |
return result
|
32 |
|
33 |
# Erstellen der Gradio-Oberfläche
|
34 |
+
input_image = gr.Image(width=224, height=224, image_mode='RGB')
|
35 |
output_label = gr.Label()
|
36 |
interface = gr.Interface(fn=predict_pokemon,
|
37 |
inputs=input_image,
|