ak0601 commited on
Commit
9839997
·
1 Parent(s): 3204e1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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
- # Load and preprocess the image
12
- img1 = image.load_img(input_image, target_size=(64, 64))
13
- img2 = image.load_img(input_image)
 
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