httpsAkayush commited on
Commit
a6ad955
·
1 Parent(s): 1de0c34
Files changed (1) hide show
  1. app.py +4 -3
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
- temp_path = "temp_leaf.jpg"
60
- image.save(temp_path)
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