Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
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 =
|
16 |
-
img = np.expand_dims(
|
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 |
|