Jeyzimtech commited on
Commit
80a40ad
·
verified ·
1 Parent(s): 73901d2

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +2 -1
api.py CHANGED
@@ -66,7 +66,8 @@ async def analyze_image(file: UploadFile = File(...)):
66
  image = Image.open(io.BytesIO(contents)).convert('RGB')
67
  image_tensor = test_transform(image).unsqueeze(0).to(device)
68
  except Exception as e:
69
- raise HTTPException(status_code=400, detail="Invalid image file or unsupported format")
 
70
 
71
  with torch.no_grad():
72
  # First verify if it's a tomato leaf
 
66
  image = Image.open(io.BytesIO(contents)).convert('RGB')
67
  image_tensor = test_transform(image).unsqueeze(0).to(device)
68
  except Exception as e:
69
+ print(f"FAILED TO LOAD IMAGE: {e}")
70
+ raise HTTPException(status_code=400, detail=f"Invalid image file or unsupported format: {str(e)}")
71
 
72
  with torch.no_grad():
73
  # First verify if it's a tomato leaf