Update count logic
Browse files- handler.py +5 -2
handler.py
CHANGED
|
@@ -77,7 +77,7 @@ class EndpointHandler():
|
|
| 77 |
prompt = data.pop("inputs", None)
|
| 78 |
image = data.pop("image", None)
|
| 79 |
controlnet_type = data.pop("controlnet_type", None)
|
| 80 |
-
count = data.pop("count",
|
| 81 |
|
| 82 |
# Check if neither prompt nor image is provided
|
| 83 |
if prompt is None and image is None:
|
|
@@ -120,7 +120,10 @@ class EndpointHandler():
|
|
| 120 |
|
| 121 |
|
| 122 |
# return first generate PIL image
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
# helper to decode input image
|
| 126 |
def decode_base64_image(self, image_string):
|
|
|
|
| 77 |
prompt = data.pop("inputs", None)
|
| 78 |
image = data.pop("image", None)
|
| 79 |
controlnet_type = data.pop("controlnet_type", None)
|
| 80 |
+
count = data.pop("count", None)
|
| 81 |
|
| 82 |
# Check if neither prompt nor image is provided
|
| 83 |
if prompt is None and image is None:
|
|
|
|
| 120 |
|
| 121 |
|
| 122 |
# return first generate PIL image
|
| 123 |
+
if count is None:
|
| 124 |
+
return out.images[0]
|
| 125 |
+
if count is not None:
|
| 126 |
+
return out.images[0:count]
|
| 127 |
|
| 128 |
# helper to decode input image
|
| 129 |
def decode_base64_image(self, image_string):
|