Update handler.py
Browse files- handler.py +16 -13
handler.py
CHANGED
|
@@ -103,19 +103,22 @@ class EndpointHandler():
|
|
| 103 |
image = self.decode_base64_image(image)
|
| 104 |
control_image = CONTROLNET_MAPPING[self.control_type]["hinter"](image)
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
# return first generate PIL image
|
|
|
|
| 103 |
image = self.decode_base64_image(image)
|
| 104 |
control_image = CONTROLNET_MAPPING[self.control_type]["hinter"](image)
|
| 105 |
|
| 106 |
+
image = image.resize((512, 512))
|
| 107 |
+
|
| 108 |
+
with torch.no_grad():
|
| 109 |
+
# run inference pipeline
|
| 110 |
+
out = self.pipe(
|
| 111 |
+
prompt=prompt,
|
| 112 |
+
negative_prompt=negative_prompt,
|
| 113 |
+
image=control_image,
|
| 114 |
+
num_inference_steps=num_inference_steps,
|
| 115 |
+
guidance_scale=guidance_scale,
|
| 116 |
+
num_images_per_prompt=1,
|
| 117 |
+
height=height,
|
| 118 |
+
width=width,
|
| 119 |
+
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
| 120 |
+
generator=self.generator
|
| 121 |
+
)
|
| 122 |
|
| 123 |
|
| 124 |
# return first generate PIL image
|