Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,13 @@ import numpy as np
|
|
8 |
model = tf.keras.models.load_model('dogcat_model_bak.h5')
|
9 |
|
10 |
def classify_image(input_image):
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
14 |
img = image.img_to_array(img1)
|
15 |
img = img / 255.0
|
16 |
img = np.expand_dims(img, axis=0)
|
17 |
-
|
18 |
# Make prediction
|
19 |
prediction = model.predict(img)
|
20 |
|
|
|
8 |
model = tf.keras.models.load_model('dogcat_model_bak.h5')
|
9 |
|
10 |
def classify_image(input_image):
|
11 |
+
pil_img = Image.fromarray(input_image.astype('uint8'), 'RGB')
|
12 |
+
# Preprocess the image
|
13 |
+
img1 = pil_img.resize((64, 64))
|
14 |
+
img2 = pil_img
|
15 |
img = image.img_to_array(img1)
|
16 |
img = img / 255.0
|
17 |
img = np.expand_dims(img, axis=0)
|
|
|
18 |
# Make prediction
|
19 |
prediction = model.predict(img)
|
20 |
|