Upload handler.py
Browse files- 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 |
-
|
47 |
-
|
|
|
|
|
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]]]:
|