Spaces:
Runtime error
Runtime error
Commit
β’
2d475e1
1
Parent(s):
3c2c999
Update app.py
Browse files
app.py
CHANGED
@@ -19,19 +19,20 @@ def process_controlnet_img(image):
|
|
19 |
controlnet_img = Image.fromarray(controlnet_img)
|
20 |
|
21 |
# load pipelines
|
|
|
|
|
22 |
taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=torch.bfloat16).to("cuda")
|
23 |
-
pipe = FluxPipeline.from_pretrained(
|
24 |
vae=taef1,
|
25 |
torch_dtype=torch.bfloat16)
|
26 |
|
27 |
pipe.transformer.to(memory_format=torch.channels_last)
|
28 |
-
pipe.transformer = torch.compile(pipe.transformer, mode="max-autotune", fullgraph=True)
|
29 |
-
#pipe.enable_model_cpu_offload()
|
30 |
clip_slider = CLIPSliderFlux(pipe, device=torch.device("cuda"))
|
31 |
|
32 |
|
33 |
-
|
34 |
-
controlnet_model = 'InstantX/FLUX.1-dev-Controlnet-Canny-alpha'
|
35 |
# controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=torch.bfloat16)
|
36 |
# pipe_controlnet = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
37 |
# t5_slider_controlnet = T5SliderFlux(sd_pipe=pipe_controlnet,device=torch.device("cuda"))
|
@@ -97,7 +98,7 @@ def generate(concept_1, concept_2, scale, prompt, randomize_seed=True, seed=42,
|
|
97 |
post_generation_slider_update = gr.update(label=comma_concepts_x, value=0, minimum=scale_min, maximum=scale_max, interactive=True)
|
98 |
avg_diff_x = avg_diff.cpu()
|
99 |
|
100 |
-
return x_concept_1,
|
101 |
|
102 |
@spaces.GPU
|
103 |
def update_scales(x,prompt,seed, steps, interm_steps, guidance_scale,
|
@@ -234,7 +235,7 @@ with gr.Blocks(css=css) as demo:
|
|
234 |
examples=examples,
|
235 |
inputs=[concept_1, concept_2, x, prompt],
|
236 |
fn=generate,
|
237 |
-
outputs=[
|
238 |
cache_examples="lazy"
|
239 |
)
|
240 |
with gr.Column():
|
|
|
19 |
controlnet_img = Image.fromarray(controlnet_img)
|
20 |
|
21 |
# load pipelines
|
22 |
+
base_model = "black-forest-labs/FLUX.1-schnell"
|
23 |
+
|
24 |
taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=torch.bfloat16).to("cuda")
|
25 |
+
pipe = FluxPipeline.from_pretrained(base_model,
|
26 |
vae=taef1,
|
27 |
torch_dtype=torch.bfloat16)
|
28 |
|
29 |
pipe.transformer.to(memory_format=torch.channels_last)
|
30 |
+
# pipe.transformer = torch.compile(pipe.transformer, mode="max-autotune", fullgraph=True)
|
31 |
+
# pipe.enable_model_cpu_offload()
|
32 |
clip_slider = CLIPSliderFlux(pipe, device=torch.device("cuda"))
|
33 |
|
34 |
|
35 |
+
# controlnet_model = 'InstantX/FLUX.1-dev-Controlnet-Canny-alpha'
|
|
|
36 |
# controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=torch.bfloat16)
|
37 |
# pipe_controlnet = FluxControlNetPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16)
|
38 |
# t5_slider_controlnet = T5SliderFlux(sd_pipe=pipe_controlnet,device=torch.device("cuda"))
|
|
|
98 |
post_generation_slider_update = gr.update(label=comma_concepts_x, value=0, minimum=scale_min, maximum=scale_max, interactive=True)
|
99 |
avg_diff_x = avg_diff.cpu()
|
100 |
|
101 |
+
return x_concept_1,x_concept_2, avg_diff_x, export_to_gif(images, "clip.gif", fps=5), canvas, images, images[scale_middle], post_generation_slider_update, seed
|
102 |
|
103 |
@spaces.GPU
|
104 |
def update_scales(x,prompt,seed, steps, interm_steps, guidance_scale,
|
|
|
235 |
examples=examples,
|
236 |
inputs=[concept_1, concept_2, x, prompt],
|
237 |
fn=generate,
|
238 |
+
outputs=[x_concept_1, x_concept_2, avg_diff_x, output_image, image_seq, total_images, post_generation_image, post_generation_slider, seed],
|
239 |
cache_examples="lazy"
|
240 |
)
|
241 |
with gr.Column():
|