Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,6 +81,10 @@ DEFAULT_STEPS = {
|
|
| 81 |
"Regular (30 steps)": 30,
|
| 82 |
}
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
def image_to_data_uri(img):
|
| 86 |
buffered = io.BytesIO()
|
|
@@ -161,7 +165,7 @@ def update_dimensions_from_image(image_list):
|
|
| 161 |
|
| 162 |
def update_steps_from_mode(mode_choice):
|
| 163 |
"""Update the number of inference steps based on the selected mode."""
|
| 164 |
-
return DEFAULT_STEPS[mode_choice]
|
| 165 |
|
| 166 |
|
| 167 |
@spaces.GPU(duration=85)
|
|
@@ -317,7 +321,7 @@ FLUX.2 [Klein] is a distilled model capable of generating, editing and combining
|
|
| 317 |
minimum=0.0,
|
| 318 |
maximum=10.0,
|
| 319 |
step=0.1,
|
| 320 |
-
value=
|
| 321 |
)
|
| 322 |
|
| 323 |
|
|
@@ -354,7 +358,7 @@ FLUX.2 [Klein] is a distilled model capable of generating, editing and combining
|
|
| 354 |
mode_choice.change(
|
| 355 |
fn=update_steps_from_mode,
|
| 356 |
inputs=[mode_choice],
|
| 357 |
-
outputs=[num_inference_steps]
|
| 358 |
)
|
| 359 |
|
| 360 |
gr.on(
|
|
|
|
| 81 |
"Regular (30 steps)": 30,
|
| 82 |
}
|
| 83 |
|
| 84 |
+
DEFAULT_CFG = {
|
| 85 |
+
"Distilled (4 steps)": 1.0,
|
| 86 |
+
"Regular (30 steps)": 4.0,
|
| 87 |
+
}
|
| 88 |
|
| 89 |
def image_to_data_uri(img):
|
| 90 |
buffered = io.BytesIO()
|
|
|
|
| 165 |
|
| 166 |
def update_steps_from_mode(mode_choice):
|
| 167 |
"""Update the number of inference steps based on the selected mode."""
|
| 168 |
+
return DEFAULT_STEPS[mode_choice], DEFAULT_CFG[mode_choice]
|
| 169 |
|
| 170 |
|
| 171 |
@spaces.GPU(duration=85)
|
|
|
|
| 321 |
minimum=0.0,
|
| 322 |
maximum=10.0,
|
| 323 |
step=0.1,
|
| 324 |
+
value=1.0,
|
| 325 |
)
|
| 326 |
|
| 327 |
|
|
|
|
| 358 |
mode_choice.change(
|
| 359 |
fn=update_steps_from_mode,
|
| 360 |
inputs=[mode_choice],
|
| 361 |
+
outputs=[num_inference_steps, guidance_scale]
|
| 362 |
)
|
| 363 |
|
| 364 |
gr.on(
|