Commit
·
a6ad955
1
Parent(s):
1de0c34
temp
Browse files
app.py
CHANGED
|
@@ -56,9 +56,10 @@ def predict_disease(image):
|
|
| 56 |
Predict plant disease from uploaded image using same preprocessing as your working cv2 method
|
| 57 |
"""
|
| 58 |
try:
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
| 62 |
img = cv2.imread(temp_path)
|
| 63 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 64 |
# Convert PIL image to array like load_img method
|
|
|
|
| 56 |
Predict plant disease from uploaded image using same preprocessing as your working cv2 method
|
| 57 |
"""
|
| 58 |
try:
|
| 59 |
+
with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as tmp:
|
| 60 |
+
temp_path = tmp.name
|
| 61 |
+
image.save(temp_path)
|
| 62 |
+
|
| 63 |
img = cv2.imread(temp_path)
|
| 64 |
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 65 |
# Convert PIL image to array like load_img method
|