Elegbede commited on
Commit
edc2516
1 Parent(s): 0390bc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -8,12 +8,12 @@ import io
8
  def predict_input_image(img):
9
  # Normalize the image by cropping (center crop)
10
  img = Image.open(io.BytesIO(img))
11
- h, w,_ = img.size
12
  crop_start_x = (w - 224) // 2
13
  crop_start_y = (h - 224) // 2
14
  img = img.crop((crop_start_x, crop_start_y, crop_start_x + 224, crop_start_y + 224))
15
- img = img.resize((224, 224))
16
- img = np.expand_dims(np.array(img) / 255.0, axis=0)
17
 
18
  my_model = load_model('Brain_Tumor_Model.h5')
19
 
 
8
  def predict_input_image(img):
9
  # Normalize the image by cropping (center crop)
10
  img = Image.open(io.BytesIO(img))
11
+ h, w= img.shape[:2]
12
  crop_start_x = (w - 224) // 2
13
  crop_start_y = (h - 224) // 2
14
  img = img.crop((crop_start_x, crop_start_y, crop_start_x + 224, crop_start_y + 224))
15
+ img = tf.image.resize(img, [224, 224])
16
+ img = np.expand_dims(img axis=0)
17
 
18
  my_model = load_model('Brain_Tumor_Model.h5')
19