Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 =
|
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])]
|