psinha823 commited on
Commit
a6468e6
·
verified ·
1 Parent(s): 78d84ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -12,9 +12,8 @@ classes = ['Colon Adenocarcinoma', 'Colon Benign Tissue', 'Lung Adenocarcinoma',
12
  # Function to preprocess the uploaded image and make predictions
13
  def predict(img):
14
  img = img.resize((224, 224))
15
- img_array = image.img_to_array(img)
16
- img_array = np.expand_dims(img_array, axis=0)
17
- img_array = img_array / 255.0 # Normalize the image
18
 
19
  predictions = model.predict(img_array)
20
  predicted_class = classes[np.argmax(predictions[0])]
 
12
  # Function to preprocess the uploaded image and make predictions
13
  def predict(img):
14
  img = img.resize((224, 224))
15
+ img_array = tf.keras.preprocessing.image.img_to_array(img)
16
+ img_array = tf.expand_dims(img_array, 0)
 
17
 
18
  predictions = model.predict(img_array)
19
  predicted_class = classes[np.argmax(predictions[0])]