whlzy commited on
Commit
e928816
·
verified ·
1 Parent(s): 1104805

Upload handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -2
handler.py CHANGED
@@ -43,8 +43,10 @@ class EndpointHandler():
43
  aws_secret_access_key=SECRET_ACCESS_KEY,
44
  region_name='auto'
45
  )
46
- image.seek(0)
47
- s3.upload_fileobj(image, BUCKET_NAME, f"{BUCKET_PREFIX_PATH}/{bucket_postfix_path}")
 
 
48
  return image_url
49
 
50
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
 
43
  aws_secret_access_key=SECRET_ACCESS_KEY,
44
  region_name='auto'
45
  )
46
+ output_buffer = BytesIO()
47
+ img_pil.save(output_buffer, format='WEBP', quality=85, method=4)
48
+ output_buffer.seek(0)
49
+ s3.upload_fileobj(output_buffer, BUCKET_NAME, f"{BUCKET_PREFIX_PATH}/{bucket_postfix_path}")
50
  return image_url
51
 
52
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]: