Spaces:
Running
Running
no controlnet
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import os
|
|
6 |
from diffusers.pipelines.flux.pipeline_flux_controlnet_inpaint import (
|
7 |
FluxControlNetInpaintPipeline,
|
8 |
)
|
|
|
9 |
from diffusers.models.controlnet_flux import FluxControlNetModel
|
10 |
from controlnet_aux import CannyDetector
|
11 |
import psutil
|
@@ -23,10 +24,11 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
23 |
base_model = "black-forest-labs/FLUX.1-dev"
|
24 |
controlnet_model = "YishaoAI/flux-dev-controlnet-canny-kid-clothes"
|
25 |
|
26 |
-
controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=dtype)
|
27 |
-
pipe = FluxControlNetInpaintPipeline.from_pretrained(
|
28 |
-
|
29 |
-
).to(device)
|
|
|
30 |
|
31 |
pipe.enable_model_cpu_offload()
|
32 |
|
@@ -61,7 +63,7 @@ def inpaint(
|
|
61 |
prompt,
|
62 |
image=image,
|
63 |
control_image=canny_image,
|
64 |
-
controlnet_conditioning_scale=controlnet_conditioning_scale,
|
65 |
mask_image=mask,
|
66 |
strength=strength,
|
67 |
num_inference_steps=num_inference_steps,
|
@@ -94,7 +96,7 @@ with gr.Blocks() as demo:
|
|
94 |
description="Upload an image and a mask, then provide a prompt to generate an inpainted image.",
|
95 |
)
|
96 |
|
97 |
-
demo.launch(debug=True
|
98 |
|
99 |
# import gradio as gr
|
100 |
# import numpy as np
|
|
|
6 |
from diffusers.pipelines.flux.pipeline_flux_controlnet_inpaint import (
|
7 |
FluxControlNetInpaintPipeline,
|
8 |
)
|
9 |
+
from diffusers.pipelines.flux.pipeline_flux_inpaint import FluxInpaintPipeline
|
10 |
from diffusers.models.controlnet_flux import FluxControlNetModel
|
11 |
from controlnet_aux import CannyDetector
|
12 |
import psutil
|
|
|
24 |
base_model = "black-forest-labs/FLUX.1-dev"
|
25 |
controlnet_model = "YishaoAI/flux-dev-controlnet-canny-kid-clothes"
|
26 |
|
27 |
+
# controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=dtype)
|
28 |
+
# pipe = FluxControlNetInpaintPipeline.from_pretrained(
|
29 |
+
# base_model, controlnet=controlnet, torch_dtype=dtype
|
30 |
+
# ).to(device)
|
31 |
+
pipe = FluxInpaintPipeline.from_pretrained(base_model, torch_dtype=dtype).to(device)
|
32 |
|
33 |
pipe.enable_model_cpu_offload()
|
34 |
|
|
|
63 |
prompt,
|
64 |
image=image,
|
65 |
control_image=canny_image,
|
66 |
+
# controlnet_conditioning_scale=controlnet_conditioning_scale,
|
67 |
mask_image=mask,
|
68 |
strength=strength,
|
69 |
num_inference_steps=num_inference_steps,
|
|
|
96 |
description="Upload an image and a mask, then provide a prompt to generate an inpainted image.",
|
97 |
)
|
98 |
|
99 |
+
demo.launch(debug=True)
|
100 |
|
101 |
# import gradio as gr
|
102 |
# import numpy as np
|