Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -167,7 +167,7 @@ async def predict_citrus(file: UploadFile = File(...)):
|
|
| 167 |
if not is_leaf(image):
|
| 168 |
return JSONResponse(status_code=400, content={
|
| 169 |
"error": "Not a leaf",
|
| 170 |
-
"message": "Please upload a clear image of a
|
| 171 |
})
|
| 172 |
|
| 173 |
# 1. Custom Resize (Using the 244x244 specification)
|
|
@@ -208,7 +208,7 @@ async def predict_corn(file: UploadFile = File(...)):
|
|
| 208 |
if not is_leaf(image):
|
| 209 |
return JSONResponse(status_code=400, content={
|
| 210 |
"error": "Not a leaf",
|
| 211 |
-
"message": "Please upload a clear image of a
|
| 212 |
})
|
| 213 |
image = image.resize((224, 224))
|
| 214 |
|
|
@@ -243,7 +243,7 @@ async def predict_apple(file: UploadFile = File(...)):
|
|
| 243 |
if not is_leaf(image):
|
| 244 |
return JSONResponse(status_code=400, content={
|
| 245 |
"error": "Not a leaf",
|
| 246 |
-
"message": "Please upload a clear image of a
|
| 247 |
})
|
| 248 |
image = image.resize((224, 224))
|
| 249 |
|
|
@@ -278,7 +278,7 @@ async def predict_potato(file: UploadFile = File(...)):
|
|
| 278 |
if not is_leaf(image):
|
| 279 |
return JSONResponse(status_code=400, content={
|
| 280 |
"error": "Not a leaf",
|
| 281 |
-
"message": "Please upload a clear image of a
|
| 282 |
})
|
| 283 |
image = image.resize((224, 224))
|
| 284 |
|
|
@@ -314,7 +314,7 @@ async def predict_tomato(file: UploadFile = File(...)):
|
|
| 314 |
if not is_leaf(image):
|
| 315 |
return JSONResponse(status_code=400, content={
|
| 316 |
"error": "Not a leaf",
|
| 317 |
-
"message": "Please upload a clear image of a
|
| 318 |
})
|
| 319 |
|
| 320 |
#Fix Added because Model was trained on leaf images with black background.
|
|
@@ -376,7 +376,7 @@ async def predict_rice(file: UploadFile = File(...)):
|
|
| 376 |
if not is_leaf(image):
|
| 377 |
return JSONResponse(status_code=400, content={
|
| 378 |
"error": "Not a leaf",
|
| 379 |
-
"message": "Please upload a clear image of a
|
| 380 |
})
|
| 381 |
image = image.resize((224, 224))
|
| 382 |
|
|
|
|
| 167 |
if not is_leaf(image):
|
| 168 |
return JSONResponse(status_code=400, content={
|
| 169 |
"error": "Not a leaf",
|
| 170 |
+
"message": "Please upload a clear image of a PLANT leaf."
|
| 171 |
})
|
| 172 |
|
| 173 |
# 1. Custom Resize (Using the 244x244 specification)
|
|
|
|
| 208 |
if not is_leaf(image):
|
| 209 |
return JSONResponse(status_code=400, content={
|
| 210 |
"error": "Not a leaf",
|
| 211 |
+
"message": "Please upload a clear image of a PLANT leaf."
|
| 212 |
})
|
| 213 |
image = image.resize((224, 224))
|
| 214 |
|
|
|
|
| 243 |
if not is_leaf(image):
|
| 244 |
return JSONResponse(status_code=400, content={
|
| 245 |
"error": "Not a leaf",
|
| 246 |
+
"message": "Please upload a clear image of a PLANT leaf."
|
| 247 |
})
|
| 248 |
image = image.resize((224, 224))
|
| 249 |
|
|
|
|
| 278 |
if not is_leaf(image):
|
| 279 |
return JSONResponse(status_code=400, content={
|
| 280 |
"error": "Not a leaf",
|
| 281 |
+
"message": "Please upload a clear image of a PLANT leaf."
|
| 282 |
})
|
| 283 |
image = image.resize((224, 224))
|
| 284 |
|
|
|
|
| 314 |
if not is_leaf(image):
|
| 315 |
return JSONResponse(status_code=400, content={
|
| 316 |
"error": "Not a leaf",
|
| 317 |
+
"message": "Please upload a clear image of a PLANT leaf."
|
| 318 |
})
|
| 319 |
|
| 320 |
#Fix Added because Model was trained on leaf images with black background.
|
|
|
|
| 376 |
if not is_leaf(image):
|
| 377 |
return JSONResponse(status_code=400, content={
|
| 378 |
"error": "Not a leaf",
|
| 379 |
+
"message": "Please upload a clear image of a PLANT leaf."
|
| 380 |
})
|
| 381 |
image = image.resize((224, 224))
|
| 382 |
|