kumararvindibs commited on
Commit
c84ac25
·
verified ·
1 Parent(s): cec4136

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -6
handler.py CHANGED
@@ -23,16 +23,16 @@ class EndpointHandler():
23
  logging.error(f"----------This is an error message {str(data)}")
24
  input_data = data.get("inputs", {})
25
  logging.warning(f"------input_data-- {str(input_data)}")
26
- encoded_images = input_data.get("images")
27
- logging.warning(f"---encoded_images----- {str(encoded_images)}")
28
- if not encoded_images:
29
- logging.warning(f"---encoded_images--not provided in if block--- {str(encoded_images)}")
30
  return {"captions": [], "error": "No images provided"}
31
  try:
32
- logging.warning(f"---encoded_images-- provided in try block--- {str(encoded_images)}")
33
  byteImgIO = io.BytesIO()
34
 
35
- byteImg = Image.open(encoded_images[0])
36
  byteImg.save(byteImgIO, "PNG")
37
  byteImgIO.seek(0)
38
  byteImg = byteImgIO.read()
 
23
  logging.error(f"----------This is an error message {str(data)}")
24
  input_data = data.get("inputs", {})
25
  logging.warning(f"------input_data-- {str(input_data)}")
26
+ # encoded_images = input_data.get("images")
27
+ #logging.warning(f"---encoded_images----- {str(encoded_images)}")
28
+ if not input_data:
29
+ #logging.warning(f"---encoded_images--not provided in if block--- {str(encoded_images)}")
30
  return {"captions": [], "error": "No images provided"}
31
  try:
32
+ logging.warning(f"---encoded_images-- provided in try block--- {str(input_data)}")
33
  byteImgIO = io.BytesIO()
34
 
35
+ byteImg = Image.open(input_data)
36
  byteImg.save(byteImgIO, "PNG")
37
  byteImgIO.seek(0)
38
  byteImg = byteImgIO.read()