Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -374,11 +374,11 @@ async def predict_rice(file: UploadFile = File(...)):
|
|
| 374 |
# --- PREPROCESS IMAGE ---
|
| 375 |
image_data = await file.read()
|
| 376 |
image = Image.open(io.BytesIO(image_data)).convert("RGB")
|
| 377 |
-
if not is_leaf(image):
|
| 378 |
-
return JSONResponse(status_code=400, content={
|
| 379 |
-
"error": "Not a leaf",
|
| 380 |
-
"message": "Please upload a clear image of a PLANT leaf."
|
| 381 |
-
|
| 382 |
image = image.resize((224, 224))
|
| 383 |
|
| 384 |
input_data = np.array(image).astype(np.float32)/255.0
|
|
|
|
| 374 |
# --- PREPROCESS IMAGE ---
|
| 375 |
image_data = await file.read()
|
| 376 |
image = Image.open(io.BytesIO(image_data)).convert("RGB")
|
| 377 |
+
#if not is_leaf(image):
|
| 378 |
+
#return JSONResponse(status_code=400, content={
|
| 379 |
+
#"error": "Not a leaf",
|
| 380 |
+
#"message": "Please upload a clear image of a PLANT leaf."
|
| 381 |
+
# })
|
| 382 |
image = image.resize((224, 224))
|
| 383 |
|
| 384 |
input_data = np.array(image).astype(np.float32)/255.0
|