yamildiego commited on
Commit
02896a3
·
1 Parent(s): ecfb8ec
Files changed (1) hide show
  1. handler.py +10 -10
handler.py CHANGED
@@ -62,12 +62,10 @@ class EndpointHandler():
62
  face_adapter = f"/repository/checkpoints/ip-adapter.bin"
63
  controlnet_path = f"/repository/checkpoints/ControlNetModel"
64
 
65
- # self.controlnet_identitynet = ControlNetModel.from_pretrained(
66
- # controlnet_path, torch_dtype=dtype
67
- # )
68
 
69
- self.controlnet_identitynet = ControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch.float16)
70
-
71
  controlnet_pose_model = "thibaud/controlnet-openpose-sdxl-1.0"
72
  controlnet_canny_model = "diffusers/controlnet-canny-sdxl-1.0"
73
  controlnet_depth_model = "diffusers/controlnet-depth-sdxl-1.0-small"
@@ -285,10 +283,12 @@ class EndpointHandler():
285
  control_mask[y1:y2, x1:x2] = 255
286
  control_mask = Image.fromarray(control_mask.astype(np.uint8))
287
 
288
- control_images = [face_kps] + [
289
- self.controlnet_map_fn[s](img_controlnet).resize((width, height))
290
- for s in self.my_controlnet_selection
291
- ]
 
 
292
 
293
  print("Start inference...")
294
 
@@ -299,7 +299,7 @@ class EndpointHandler():
299
  prompt=prompt,
300
  negative_prompt=negative_prompt,
301
  image_embeds=face_emb,
302
- image=control_images,
303
  control_mask=control_mask,
304
  controlnet_conditioning_scale=self.control_scales,
305
  num_inference_steps=num_inference_steps,
 
62
  face_adapter = f"/repository/checkpoints/ip-adapter.bin"
63
  controlnet_path = f"/repository/checkpoints/ControlNetModel"
64
 
65
+ self.controlnet_identitynet = ControlNetModel.from_pretrained(
66
+ controlnet_path, torch_dtype=dtype
67
+ )
68
 
 
 
69
  controlnet_pose_model = "thibaud/controlnet-openpose-sdxl-1.0"
70
  controlnet_canny_model = "diffusers/controlnet-canny-sdxl-1.0"
71
  controlnet_depth_model = "diffusers/controlnet-depth-sdxl-1.0-small"
 
283
  control_mask[y1:y2, x1:x2] = 255
284
  control_mask = Image.fromarray(control_mask.astype(np.uint8))
285
 
286
+ # control_images = [face_kps] + [
287
+ # self.controlnet_map_fn[s](img_controlnet).resize((width, height))
288
+ # for s in self.my_controlnet_selection
289
+ # ]
290
+ face_kps_test = draw_kps(face_image, face_info['kps'])
291
+
292
 
293
  print("Start inference...")
294
 
 
299
  prompt=prompt,
300
  negative_prompt=negative_prompt,
301
  image_embeds=face_emb,
302
+ image=face_kps_test,
303
  control_mask=control_mask,
304
  controlnet_conditioning_scale=self.control_scales,
305
  num_inference_steps=num_inference_steps,