Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,11 @@ def predict(image):
|
|
12 |
# Convert to grayscale
|
13 |
img = ImageOps.grayscale(image)
|
14 |
|
15 |
-
# Resize image to match the model's expected input size (
|
16 |
-
img = img.resize((
|
17 |
|
18 |
# Convert to numpy array and normalize the pixel values
|
19 |
-
img_array = np.array(img).reshape(1,
|
20 |
|
21 |
# Make prediction
|
22 |
prediction = model.predict(img_array)
|
|
|
12 |
# Convert to grayscale
|
13 |
img = ImageOps.grayscale(image)
|
14 |
|
15 |
+
# Resize image to match the model's expected input size (299x299)
|
16 |
+
img = img.resize((299, 299)) # Resize to 299x299
|
17 |
|
18 |
# Convert to numpy array and normalize the pixel values
|
19 |
+
img_array = np.array(img).reshape(1, 299, 299, 1) / 255.0 # Reshape to (1, 299, 299, 1)
|
20 |
|
21 |
# Make prediction
|
22 |
prediction = model.predict(img_array)
|