Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,9 @@ from tensorflow.keras.models import load_model
|
|
4 |
import numpy as np
|
5 |
from tensorflow.keras.preprocessing import image
|
6 |
|
7 |
-
my_model = load_model('Brain_Tumor_Model.h5')
|
8 |
|
9 |
-
# Set a threshold for binary classification
|
10 |
-
threshold = 0.5
|
11 |
|
12 |
def predict_input_image(img):
|
13 |
-
# Normalize the image by cropping (center crop)
|
14 |
# Normalize the image by cropping (center crop)
|
15 |
h, w = img.size
|
16 |
crop_start_x = (w - 224) // 2
|
@@ -19,6 +15,11 @@ def predict_input_image(img):
|
|
19 |
img = tf.image.resize(img, [224,224])
|
20 |
img = np.expand_dims(img, axis = 0)
|
21 |
|
|
|
|
|
|
|
|
|
|
|
22 |
# Make predictions using your model
|
23 |
predictions = my_model.predict(img)
|
24 |
|
|
|
4 |
import numpy as np
|
5 |
from tensorflow.keras.preprocessing import image
|
6 |
|
|
|
7 |
|
|
|
|
|
8 |
|
9 |
def predict_input_image(img):
|
|
|
10 |
# Normalize the image by cropping (center crop)
|
11 |
h, w = img.size
|
12 |
crop_start_x = (w - 224) // 2
|
|
|
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 |
+
|
20 |
+
# Set a threshold for binary classification
|
21 |
+
threshold = 0.5
|
22 |
+
|
23 |
# Make predictions using your model
|
24 |
predictions = my_model.predict(img)
|
25 |
|