Elegbede commited on
Commit
6462de4
1 Parent(s): 2461396

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -16,15 +16,11 @@ def predict_input_image(img):
16
  crop_start_x = (w - 224) // 2
17
  crop_start_y = (h - 224) // 2
18
  img = img.crop((crop_start_x, crop_start_y, crop_start_x + 224, crop_start_y + 224))
19
- img = img.resize(224, 224)
20
- img = np.array(img).reshape(1, 224, 224, 3)
21
-
22
- # Convert the image to a format suitable for model prediction
23
- #img_array = np.array(img) / 255.0 # Normalize pixel values to [0, 1]
24
- img_array = np.expand_dims(img, axis=0)
25
 
26
  # Make predictions using your model
27
- predictions = my_model.predict(img_array)
28
 
29
  # Convert predictions to binary (0 or 1) based on the threshold
30
  binary_prediction = 'Tumor Detected' if predictions[0][0] > threshold else 'No Tumor Detected'
 
16
  crop_start_x = (w - 224) // 2
17
  crop_start_y = (h - 224) // 2
18
  img = img.crop((crop_start_x, crop_start_y, crop_start_x + 224, crop_start_y + 224))
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
 
25
  # Convert predictions to binary (0 or 1) based on the threshold
26
  binary_prediction = 'Tumor Detected' if predictions[0][0] > threshold else 'No Tumor Detected'