Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,14 +13,13 @@ class_names = [
|
|
| 13 |
"Bacterial Spot", "Early Blight", "Healthy", "Late Blight"
|
| 14 |
]
|
| 15 |
|
| 16 |
-
# Predict function for a single image
|
| 17 |
def classify(image):
|
| 18 |
if image is None:
|
| 19 |
return None
|
| 20 |
if not isinstance(image, Image.Image):
|
| 21 |
image = Image.fromarray(image)
|
| 22 |
|
| 23 |
-
image = image.resize((
|
| 24 |
img_array = np.array(image) / 255.0
|
| 25 |
img_array = np.expand_dims(img_array, axis=0)
|
| 26 |
|
|
|
|
| 13 |
"Bacterial Spot", "Early Blight", "Healthy", "Late Blight"
|
| 14 |
]
|
| 15 |
|
|
|
|
| 16 |
def classify(image):
|
| 17 |
if image is None:
|
| 18 |
return None
|
| 19 |
if not isinstance(image, Image.Image):
|
| 20 |
image = Image.fromarray(image)
|
| 21 |
|
| 22 |
+
image = image.resize((300, 300)) # 👈 match the model's input shape
|
| 23 |
img_array = np.array(image) / 255.0
|
| 24 |
img_array = np.expand_dims(img_array, axis=0)
|
| 25 |
|