Upload app.py
Browse files
app.py
CHANGED
@@ -38,6 +38,8 @@ good_vae = AutoencoderKL.from_pretrained(base_model, subfolder="vae", torch_dtyp
|
|
38 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, vae=taef1).to(device)
|
39 |
controlnet_union = None
|
40 |
controlnet = None
|
|
|
|
|
41 |
last_model = models[0]
|
42 |
last_cn_on = False
|
43 |
|
@@ -60,8 +62,8 @@ def change_base_model(repo_id: str, cn_on: bool, progress=gr.Progress(track_tqdm
|
|
60 |
#progress(0, desc=f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
61 |
print(f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
62 |
#clear_cache()
|
63 |
-
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union_repo, torch_dtype=dtype).to(device)
|
64 |
-
controlnet = FluxMultiControlNetModel([controlnet_union]).to(device)
|
65 |
pipe = FluxControlNetPipeline.from_pretrained(repo_id, controlnet=controlnet, torch_dtype=dtype).to(device)
|
66 |
#pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
67 |
last_model = repo_id
|
@@ -169,8 +171,8 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, lora_scal
|
|
169 |
yield img
|
170 |
else:
|
171 |
progress(0, desc="Start Inference with ControlNet.")
|
172 |
-
if controlnet is not None: controlnet.to("cuda")
|
173 |
-
if controlnet_union is not None: controlnet_union.to("cuda")
|
174 |
for img in pipe(
|
175 |
prompt=prompt_mash,
|
176 |
control_image=images,
|
|
|
38 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=dtype, vae=taef1).to(device)
|
39 |
controlnet_union = None
|
40 |
controlnet = None
|
41 |
+
controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union_repo, torch_dtype=dtype).to(device)
|
42 |
+
controlnet = FluxMultiControlNetModel([controlnet_union]).to(device)
|
43 |
last_model = models[0]
|
44 |
last_cn_on = False
|
45 |
|
|
|
62 |
#progress(0, desc=f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
63 |
print(f"Loading model: {repo_id} / Loading ControlNet: {controlnet_model_union_repo}")
|
64 |
#clear_cache()
|
65 |
+
#controlnet_union = FluxControlNetModel.from_pretrained(controlnet_model_union_repo, torch_dtype=dtype).to(device)
|
66 |
+
#controlnet = FluxMultiControlNetModel([controlnet_union]).to(device)
|
67 |
pipe = FluxControlNetPipeline.from_pretrained(repo_id, controlnet=controlnet, torch_dtype=dtype).to(device)
|
68 |
#pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
69 |
last_model = repo_id
|
|
|
171 |
yield img
|
172 |
else:
|
173 |
progress(0, desc="Start Inference with ControlNet.")
|
174 |
+
#if controlnet is not None: controlnet.to("cuda")
|
175 |
+
#if controlnet_union is not None: controlnet_union.to("cuda")
|
176 |
for img in pipe(
|
177 |
prompt=prompt_mash,
|
178 |
control_image=images,
|