Zhibinhong
commited on
Commit
•
9b5b006
1
Parent(s):
9c246cc
Update handler.py
Browse files- handler.py +2 -1
handler.py
CHANGED
@@ -3,6 +3,7 @@ from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDisc
|
|
3 |
import base64
|
4 |
from io import BytesIO
|
5 |
from PIL import Image
|
|
|
6 |
|
7 |
class EndpointHandler():
|
8 |
def __init__(self, path=""):
|
@@ -20,7 +21,7 @@ class EndpointHandler():
|
|
20 |
raw_images = Image.open(BytesIO(image)).convert('RGB')
|
21 |
|
22 |
images = self.pipe(prompt, image=raw_images, num_inference_steps=25, image_guidance_scale=1).images
|
23 |
-
return images[0]
|
24 |
|
25 |
|
26 |
|
|
|
3 |
import base64
|
4 |
from io import BytesIO
|
5 |
from PIL import Image
|
6 |
+
import json
|
7 |
|
8 |
class EndpointHandler():
|
9 |
def __init__(self, path=""):
|
|
|
21 |
raw_images = Image.open(BytesIO(image)).convert('RGB')
|
22 |
|
23 |
images = self.pipe(prompt, image=raw_images, num_inference_steps=25, image_guidance_scale=1).images
|
24 |
+
return json.dumps({'image':images[0]})
|
25 |
|
26 |
|
27 |
|