HemanthR007 commited on
Commit
626c216
·
verified ·
1 Parent(s): 4165f24

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -3
main.py CHANGED
@@ -173,9 +173,8 @@ async def predict(payload: ImagePayload):
173
  if not img_base64:
174
  return {"error": "No image provided"}
175
 
176
- image_data = base64.b64decode(img_base64)
177
- image = Image.open(io.BytesIO(image_data))
178
-
179
  # Preprocess
180
  processed_img = preprocess_image(image)
181
 
 
173
  if not img_base64:
174
  return {"error": "No image provided"}
175
 
176
+ if img_base64.startswith("data:image"):
177
+ img_base64 = img_base64.split(",")[1]
 
178
  # Preprocess
179
  processed_img = preprocess_image(image)
180