Quoc Bao Bui
commited on
Commit
·
b1bfbf4
1
Parent(s):
eddf5bd
Add handling text prompt input only logic
Browse files- handler.py +5 -3
handler.py
CHANGED
@@ -31,10 +31,12 @@ class EndpointHandler:
|
|
31 |
Return:
|
32 |
A :obj:`dict`:. base64 encoded image
|
33 |
"""
|
34 |
-
prompts = data.pop("
|
35 |
encoded_image = data.pop("image", None)
|
36 |
-
init_image =
|
37 |
-
|
|
|
|
|
38 |
image = self.pipe(prompts, init_image=init_image).images[0]
|
39 |
|
40 |
# encode image as base 64
|
|
|
31 |
Return:
|
32 |
A :obj:`dict`:. base64 encoded image
|
33 |
"""
|
34 |
+
prompts = data.pop("inputs", None)
|
35 |
encoded_image = data.pop("image", None)
|
36 |
+
init_image = None
|
37 |
+
if encoded_image:
|
38 |
+
init_image = decode_base64_image(encoded_image)
|
39 |
+
init_image.thumbnail((768, 768))
|
40 |
image = self.pipe(prompts, init_image=init_image).images[0]
|
41 |
|
42 |
# encode image as base 64
|