Elegbede commited on
Commit
3e2a740
1 Parent(s): 34e235e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -7,7 +7,10 @@ import io
7
 
8
  def predict_input_image(img):
9
  # Normalize the image by cropping (center crop)
10
-
 
 
 
11
  img = tf.image.resize(img, [224, 224])
12
  img = np.expand_dims(img, axis=0)
13
 
 
7
 
8
  def predict_input_image(img):
9
  # Normalize the image by cropping (center crop)
10
+ h, w = img.shape[:2]
11
+ crop_start_x = (w - 224) // 2
12
+ crop_start_y = (h - 224) // 2
13
+ img = img[crop_start_y:crop_start_y+224, crop_start_x:crop_start_x+224]
14
  img = tf.image.resize(img, [224, 224])
15
  img = np.expand_dims(img, axis=0)
16