Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,6 @@ model = tf.keras.models.load_model('pokemon_model.keras')
|
|
| 10 |
class_names = ['Jolteon', 'Kakuna', 'Mr. Mime']
|
| 11 |
|
| 12 |
def classify_image(image):
|
| 13 |
-
try:
|
| 14 |
image = Image.fromarray(image.astype('uint8'), 'RGB')
|
| 15 |
img = image.resize((160, 160))
|
| 16 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
|
@@ -19,9 +18,6 @@ class_names = ['Jolteon', 'Kakuna', 'Mr. Mime']
|
|
| 19 |
predicted_class = class_names[np.argmax(predictions[0])]
|
| 20 |
confidence = np.max(predictions[0])
|
| 21 |
return predicted_class, confidence
|
| 22 |
-
except Exception as e:
|
| 23 |
-
# Gib den Fehlerstring zurück
|
| 24 |
-
return str(e), 'Error'
|
| 25 |
|
| 26 |
|
| 27 |
image_input = gr.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)
|
|
|
|
| 18 |
predicted_class = class_names[np.argmax(predictions[0])]
|
| 19 |
confidence = np.max(predictions[0])
|
| 20 |
return predicted_class, confidence
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
image_input = gr.Image()
|