Spaces:
Runtime error
Runtime error
Update app.py
Browse filesmake hyper flux lora optional
app.py
CHANGED
|
@@ -20,7 +20,8 @@ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev",
|
|
| 20 |
custom_pipeline="pipeline_flux_rf_inversion",
|
| 21 |
torch_dtype=torch.bfloat16)
|
| 22 |
pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8steps-lora.safetensors"), lora_scale=0.125)
|
| 23 |
-
pipe.fuse_lora(lora_scale=0.125)
|
|
|
|
| 24 |
pipe.to(DEVICE)
|
| 25 |
|
| 26 |
examples = [[Image.open("cat.jpg"), "a tiger", 0, 4, 0.5, 0.9, False, 1, 8, 8, 789385745, False],
|
|
@@ -38,6 +39,14 @@ def resize_img(image, max_size=1024):
|
|
| 38 |
def check_style(stylezation):
|
| 39 |
return True, 2
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
@spaces.GPU(duration=85)
|
| 42 |
def invert_and_edit(image,
|
| 43 |
prompt,
|
|
@@ -117,7 +126,9 @@ based on the implementations of [@raven38](https://github.com/raven38) & [@DarkM
|
|
| 117 |
max_lines=1,
|
| 118 |
placeholder="describe the edited output",
|
| 119 |
)
|
| 120 |
-
|
|
|
|
|
|
|
| 121 |
with gr.Row():
|
| 122 |
start_timestep = gr.Slider(
|
| 123 |
label="start timestep",
|
|
@@ -265,6 +276,12 @@ based on the implementations of [@raven38](https://github.com/raven38) & [@DarkM
|
|
| 265 |
inputs=[stylezation],
|
| 266 |
outputs=[eta_decay, decay_power]
|
| 267 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
|
| 270 |
|
|
|
|
| 20 |
custom_pipeline="pipeline_flux_rf_inversion",
|
| 21 |
torch_dtype=torch.bfloat16)
|
| 22 |
pipe.load_lora_weights(hf_hub_download("ByteDance/Hyper-SD", "Hyper-FLUX.1-dev-8steps-lora.safetensors"), lora_scale=0.125)
|
| 23 |
+
#pipe.fuse_lora(lora_scale=0.125)
|
| 24 |
+
pipe.enable_lora()
|
| 25 |
pipe.to(DEVICE)
|
| 26 |
|
| 27 |
examples = [[Image.open("cat.jpg"), "a tiger", 0, 4, 0.5, 0.9, False, 1, 8, 8, 789385745, False],
|
|
|
|
| 39 |
def check_style(stylezation):
|
| 40 |
return True, 2
|
| 41 |
|
| 42 |
+
def check_hyper_flux_lora(enable_hyper_flux):
|
| 43 |
+
if enable_hyper_flux:
|
| 44 |
+
pipe.enable_lora()
|
| 45 |
+
return 8, 8, 4
|
| 46 |
+
else:
|
| 47 |
+
pipe.disable_lora()
|
| 48 |
+
return 28, 28, 7
|
| 49 |
+
|
| 50 |
@spaces.GPU(duration=85)
|
| 51 |
def invert_and_edit(image,
|
| 52 |
prompt,
|
|
|
|
| 126 |
max_lines=1,
|
| 127 |
placeholder="describe the edited output",
|
| 128 |
)
|
| 129 |
+
with gr.Row():
|
| 130 |
+
enable_hyper_flux = gr.Checkbox(label="8-step LoRA", value=True)
|
| 131 |
+
stylezation = gr.Checkbox(label="stylzation")
|
| 132 |
with gr.Row():
|
| 133 |
start_timestep = gr.Slider(
|
| 134 |
label="start timestep",
|
|
|
|
| 276 |
inputs=[stylezation],
|
| 277 |
outputs=[eta_decay, decay_power]
|
| 278 |
)
|
| 279 |
+
|
| 280 |
+
enable_hyper_flux.change(
|
| 281 |
+
fn=check_hyper_flux_lora,
|
| 282 |
+
inputs=[enable_hyper_flux],
|
| 283 |
+
outputs=[num_inversion_steps, num_inference_steps, stop_timestep]
|
| 284 |
+
)
|
| 285 |
|
| 286 |
|
| 287 |
|