Spaces:
Runtime error
Runtime error
back to ctrl
Browse files
app.py
CHANGED
@@ -26,10 +26,10 @@ base_model = "black-forest-labs/FLUX.1-dev"
|
|
26 |
controlnet_model = "InstantX/FLUX.1-dev-Controlnet-Canny"
|
27 |
|
28 |
controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=dtype)
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
pipe = FluxInpaintPipeline.from_pretrained(base_model, torch_dtype=dtype).to(device)
|
33 |
|
34 |
pipe.enable_model_cpu_offload()
|
35 |
|
@@ -95,12 +95,13 @@ def inpaint(
|
|
95 |
image_res = pipe(
|
96 |
prompt,
|
97 |
image=resized_image,
|
98 |
-
|
99 |
mask_image=resized_mask,
|
100 |
strength=strength,
|
101 |
num_inference_steps=num_inference_steps,
|
102 |
guidance_scale=guidance_scale,
|
103 |
-
generator=generator
|
|
|
104 |
).images[0]
|
105 |
|
106 |
return image_res, canny_image, resized_image, resized_mask
|
|
|
26 |
controlnet_model = "InstantX/FLUX.1-dev-Controlnet-Canny"
|
27 |
|
28 |
controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=dtype)
|
29 |
+
pipe = FluxControlNetInpaintPipeline.from_pretrained(
|
30 |
+
base_model, controlnet=controlnet, torch_dtype=dtype
|
31 |
+
).to(device)
|
32 |
+
# pipe = FluxInpaintPipeline.from_pretrained(base_model, torch_dtype=dtype).to(device)
|
33 |
|
34 |
pipe.enable_model_cpu_offload()
|
35 |
|
|
|
95 |
image_res = pipe(
|
96 |
prompt,
|
97 |
image=resized_image,
|
98 |
+
control_image=canny_image,
|
99 |
mask_image=resized_mask,
|
100 |
strength=strength,
|
101 |
num_inference_steps=num_inference_steps,
|
102 |
guidance_scale=guidance_scale,
|
103 |
+
generator=generator,
|
104 |
+
controlnet_conditioning_scale=0.1
|
105 |
).images[0]
|
106 |
|
107 |
return image_res, canny_image, resized_image, resized_mask
|