Commit
•
f806422
1
Parent(s):
e6af97e
not implemented
Browse files- handler.py +13 -25
handler.py
CHANGED
@@ -36,6 +36,7 @@ class EndpointHandler():
|
|
36 |
image_data = data.pop("inputs", data).decode('base64')
|
37 |
init_image = Image.open(image_data).convert("RGB")
|
38 |
init_image.thumbnail((512, 512))
|
|
|
39 |
|
40 |
params = data.pop("parameters", data)
|
41 |
|
@@ -50,31 +51,18 @@ class EndpointHandler():
|
|
50 |
|
51 |
out = None
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
)
|
66 |
-
else:
|
67 |
-
# run text pipeline
|
68 |
-
out = self.textPipe(prompt,
|
69 |
-
image=init_image,
|
70 |
-
num_inference_steps=num_inference_steps,
|
71 |
-
guidance_scale=guidance_scale,
|
72 |
-
num_images_per_prompt=1,
|
73 |
-
negative_prompt=negative_prompt,
|
74 |
-
height=height,
|
75 |
-
width=width
|
76 |
-
)
|
77 |
-
|
78 |
|
79 |
# return first generated PIL image
|
80 |
return out.images[0]
|
|
|
36 |
image_data = data.pop("inputs", data).decode('base64')
|
37 |
init_image = Image.open(image_data).convert("RGB")
|
38 |
init_image.thumbnail((512, 512))
|
39 |
+
raise NotImplementedError()
|
40 |
|
41 |
params = data.pop("parameters", data)
|
42 |
|
|
|
51 |
|
52 |
out = None
|
53 |
|
54 |
+
generator = torch.Generator(device='cuda')
|
55 |
+
generator.manual_seed(manual_seed)
|
56 |
+
# run img2img pipeline
|
57 |
+
out = self.imgPipe(prompt,
|
58 |
+
image=init_image,
|
59 |
+
num_inference_steps=num_inference_steps,
|
60 |
+
guidance_scale=guidance_scale,
|
61 |
+
num_images_per_prompt=1,
|
62 |
+
negative_prompt=negative_prompt,
|
63 |
+
height=height,
|
64 |
+
width=width
|
65 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
# return first generated PIL image
|
68 |
return out.images[0]
|