Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
|
@@ -36,7 +36,7 @@ class EndpointHandler:
|
|
| 36 |
if image_data is None:
|
| 37 |
return [{"error": "Missing 'inputs' key"}]
|
| 38 |
# Wake up function to restart the server
|
| 39 |
-
|
| 40 |
return [{"status": "woken"}]
|
| 41 |
|
| 42 |
# Generation args
|
|
@@ -49,7 +49,7 @@ class EndpointHandler:
|
|
| 49 |
# Decode base64 image
|
| 50 |
try:
|
| 51 |
image = Image.open(io.BytesIO(base64.b64decode(image_data))).convert("RGB")
|
| 52 |
-
image.thumbnail([512,512], Image.
|
| 53 |
except Exception as e:
|
| 54 |
return [{"error": f"Image decoding failed: {str(e)}"}]
|
| 55 |
|
|
|
|
| 36 |
if image_data is None:
|
| 37 |
return [{"error": "Missing 'inputs' key"}]
|
| 38 |
# Wake up function to restart the server
|
| 39 |
+
if image_data == "wake":
|
| 40 |
return [{"status": "woken"}]
|
| 41 |
|
| 42 |
# Generation args
|
|
|
|
| 49 |
# Decode base64 image
|
| 50 |
try:
|
| 51 |
image = Image.open(io.BytesIO(base64.b64decode(image_data))).convert("RGB")
|
| 52 |
+
image.thumbnail([512,512], Image.BILINEAR)
|
| 53 |
except Exception as e:
|
| 54 |
return [{"error": f"Image decoding failed: {str(e)}"}]
|
| 55 |
|