zhiweili commited on
Commit
125fda8
1 Parent(s): 9252cec

add multi contronet

Browse files
Files changed (1) hide show
  1. app_haircolor_inpaint_15.py +6 -6
app_haircolor_inpaint_15.py CHANGED
@@ -35,10 +35,10 @@ controlnet = [
35
  "lllyasviel/control_v11p_sd15_inpaint",
36
  torch_dtype=torch.float16,
37
  ),
38
- # ControlNetModel.from_pretrained(
39
- # "diffusers/controlnet-canny-sdxl-1.0",
40
- # torch_dtype=torch.float16,
41
- # ),
42
  ]
43
 
44
  basepipeline = StableDiffusionControlNetInpaintPipeline.from_pretrained(
@@ -70,7 +70,7 @@ def image_to_image(
70
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
71
  canny_image = canny_detector(input_image, int(generate_size*0.375), generate_size)
72
  inpaint_image = make_inpaint_condition(input_image, mask_image)
73
- control_image = [inpaint_image]
74
 
75
  generator = torch.Generator(device=DEVICE).manual_seed(seed)
76
  generated_image = basepipeline(
@@ -84,7 +84,7 @@ def image_to_image(
84
  width=generate_size,
85
  guidance_scale=guidance_scale,
86
  num_inference_steps=num_steps,
87
- # controlnet_conditioning_scale=[inpaint_scale, canny_scale]
88
  ).images[0]
89
 
90
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
 
35
  "lllyasviel/control_v11p_sd15_inpaint",
36
  torch_dtype=torch.float16,
37
  ),
38
+ ControlNetModel.from_pretrained(
39
+ "lllyasviel/control_v11p_sd15_canny",
40
+ torch_dtype=torch.float16,
41
+ ),
42
  ]
43
 
44
  basepipeline = StableDiffusionControlNetInpaintPipeline.from_pretrained(
 
70
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
71
  canny_image = canny_detector(input_image, int(generate_size*0.375), generate_size)
72
  inpaint_image = make_inpaint_condition(input_image, mask_image)
73
+ control_image = [inpaint_image, canny_image]
74
 
75
  generator = torch.Generator(device=DEVICE).manual_seed(seed)
76
  generated_image = basepipeline(
 
84
  width=generate_size,
85
  guidance_scale=guidance_scale,
86
  num_inference_steps=num_steps,
87
+ controlnet_conditioning_scale=[inpaint_scale, canny_scale]
88
  ).images[0]
89
 
90
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)