Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ class_names = ['Aerodactyl', 'Charizard', 'Victreebel']
|
|
| 12 |
|
| 13 |
def classify_image(image):
|
| 14 |
image = Image.fromarray(image.astype('uint8'), 'RGB')
|
| 15 |
-
img = image.resize((
|
| 16 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
| 17 |
img_array = tf.expand_dims(img_array, 0) # Erstelle einen Batch
|
| 18 |
predictions = model.predict(img_array)
|
|
@@ -20,6 +20,7 @@ def classify_image(image):
|
|
| 20 |
confidence = np.max(predictions[0])
|
| 21 |
return {predicted_class: float(confidence)}
|
| 22 |
|
|
|
|
| 23 |
image_input = gr.Image()
|
| 24 |
label = gr.Label(num_top_classes=3)
|
| 25 |
|
|
|
|
| 12 |
|
| 13 |
def classify_image(image):
|
| 14 |
image = Image.fromarray(image.astype('uint8'), 'RGB')
|
| 15 |
+
img = image.resize((224, 224)) # Ändern Sie die Größe auf 224x224
|
| 16 |
img_array = tf.keras.preprocessing.image.img_to_array(img)
|
| 17 |
img_array = tf.expand_dims(img_array, 0) # Erstelle einen Batch
|
| 18 |
predictions = model.predict(img_array)
|
|
|
|
| 20 |
confidence = np.max(predictions[0])
|
| 21 |
return {predicted_class: float(confidence)}
|
| 22 |
|
| 23 |
+
|
| 24 |
image_input = gr.Image()
|
| 25 |
label = gr.Label(num_top_classes=3)
|
| 26 |
|