Commit ·
411a1fc
1
Parent(s): 8346c14
test
Browse files- handler.py +6 -7
handler.py
CHANGED
|
@@ -45,6 +45,7 @@ class EndpointHandler():
|
|
| 45 |
root="./",
|
| 46 |
providers=["CPUExecutionProvider"],
|
| 47 |
)
|
|
|
|
| 48 |
self.app.prepare(ctx_id=0, det_size=(640, 640))
|
| 49 |
|
| 50 |
openpose = OpenposeDetector.from_pretrained("lllyasviel/ControlNet")
|
|
@@ -288,12 +289,10 @@ class EndpointHandler():
|
|
| 288 |
control_mask[y1:y2, x1:x2] = 255
|
| 289 |
control_mask = Image.fromarray(control_mask.astype(np.uint8))
|
| 290 |
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
face_kps_test = draw_kps(face_image, face_info['kps'])
|
| 296 |
-
|
| 297 |
|
| 298 |
print("Start inference...")
|
| 299 |
|
|
@@ -304,7 +303,7 @@ class EndpointHandler():
|
|
| 304 |
prompt=prompt,
|
| 305 |
negative_prompt=negative_prompt,
|
| 306 |
image_embeds=face_emb,
|
| 307 |
-
image=
|
| 308 |
control_mask=control_mask,
|
| 309 |
controlnet_conditioning_scale=self.control_scales,
|
| 310 |
num_inference_steps=num_inference_steps,
|
|
|
|
| 45 |
root="./",
|
| 46 |
providers=["CPUExecutionProvider"],
|
| 47 |
)
|
| 48 |
+
|
| 49 |
self.app.prepare(ctx_id=0, det_size=(640, 640))
|
| 50 |
|
| 51 |
openpose = OpenposeDetector.from_pretrained("lllyasviel/ControlNet")
|
|
|
|
| 289 |
control_mask[y1:y2, x1:x2] = 255
|
| 290 |
control_mask = Image.fromarray(control_mask.astype(np.uint8))
|
| 291 |
|
| 292 |
+
control_images = [face_kps] + [
|
| 293 |
+
self.controlnet_map_fn[s](img_controlnet).resize((width, height))
|
| 294 |
+
for s in self.my_controlnet_selection
|
| 295 |
+
]
|
|
|
|
|
|
|
| 296 |
|
| 297 |
print("Start inference...")
|
| 298 |
|
|
|
|
| 303 |
prompt=prompt,
|
| 304 |
negative_prompt=negative_prompt,
|
| 305 |
image_embeds=face_emb,
|
| 306 |
+
image=control_images,
|
| 307 |
control_mask=control_mask,
|
| 308 |
controlnet_conditioning_scale=self.control_scales,
|
| 309 |
num_inference_steps=num_inference_steps,
|