Spaces:
Running
on
Zero
Running
on
Zero
Update app_local.py
Browse files- app_local.py +3 -23
app_local.py
CHANGED
|
@@ -319,7 +319,7 @@ def infer(
|
|
| 319 |
return pil_image # Return original if resize fails
|
| 320 |
|
| 321 |
# Add noise function for batch variation
|
| 322 |
-
def add_noise_to_image(pil_image, noise_level=0.
|
| 323 |
"""Add slight noise to image to create variation in outputs"""
|
| 324 |
try:
|
| 325 |
if pil_image is None:
|
|
@@ -409,7 +409,7 @@ def infer(
|
|
| 409 |
if i == 0 and len(batch_prompts) == 1:
|
| 410 |
input_image = image
|
| 411 |
else:
|
| 412 |
-
input_image = add_noise_to_image(image, noise_level=0.
|
| 413 |
|
| 414 |
# Slightly vary guidance scale for each image
|
| 415 |
varied_guidance = true_guidance_scale + random.uniform(-0.1, 0.1)
|
|
@@ -530,7 +530,7 @@ with gr.Blocks(title="Qwen Image Edit - Fast Lightning Mode w/ Batch") as demo:
|
|
| 530 |
minimum=1.0,
|
| 531 |
maximum=10.0,
|
| 532 |
step=0.1,
|
| 533 |
-
value=
|
| 534 |
)
|
| 535 |
num_inference_steps = gr.Slider(
|
| 536 |
label="Inference Steps",
|
|
@@ -563,26 +563,6 @@ with gr.Blocks(title="Qwen Image Edit - Fast Lightning Mode w/ Batch") as demo:
|
|
| 563 |
"Prompt details will appear after generation. Ability to edit Preset Prompts on the fly will be implemented shortly.</div>"
|
| 564 |
)
|
| 565 |
|
| 566 |
-
def toggle_output_count(preset_type):
|
| 567 |
-
if preset_type and preset_type in PRESETS:
|
| 568 |
-
# When preset is selected, disable manual output count
|
| 569 |
-
preset = PRESETS[preset_type]
|
| 570 |
-
return (
|
| 571 |
-
gr.Group(visible=True),
|
| 572 |
-
gr.Slider(interactive=False), # Disable slider
|
| 573 |
-
preset_prompt_1.update(value=preset["prompts"][0] if len(preset["prompts"]) > 0 else ""),
|
| 574 |
-
preset_prompt_2.update(value=preset["prompts"][1] if len(preset["prompts"]) > 1 else ""),
|
| 575 |
-
preset_prompt_3.update(value=preset["prompts"][2] if len(preset["prompts"]) > 2 else ""),
|
| 576 |
-
preset_prompt_4.update(value=preset["prompts"][3] if len(preset["prompts"]) > 3 else "")
|
| 577 |
-
)
|
| 578 |
-
else:
|
| 579 |
-
# When no preset is selected, enable manual output count
|
| 580 |
-
return (
|
| 581 |
-
gr.Group(visible=False),
|
| 582 |
-
gr.Slider(interactive=True), # Enable slider
|
| 583 |
-
gr.Textbox(value=""), gr.Textbox(value=""), gr.Textbox(value=""), gr.Textbox(value="")
|
| 584 |
-
)
|
| 585 |
-
|
| 586 |
# Function to show preset editor when a preset is selected
|
| 587 |
def show_preset_editor(preset_type):
|
| 588 |
if preset_type and preset_type in PRESETS:
|
|
|
|
| 319 |
return pil_image # Return original if resize fails
|
| 320 |
|
| 321 |
# Add noise function for batch variation
|
| 322 |
+
def add_noise_to_image(pil_image, noise_level=0.001):
|
| 323 |
"""Add slight noise to image to create variation in outputs"""
|
| 324 |
try:
|
| 325 |
if pil_image is None:
|
|
|
|
| 409 |
if i == 0 and len(batch_prompts) == 1:
|
| 410 |
input_image = image
|
| 411 |
else:
|
| 412 |
+
input_image = add_noise_to_image(image, noise_level=0.001 + i*0.003)
|
| 413 |
|
| 414 |
# Slightly vary guidance scale for each image
|
| 415 |
varied_guidance = true_guidance_scale + random.uniform(-0.1, 0.1)
|
|
|
|
| 530 |
minimum=1.0,
|
| 531 |
maximum=10.0,
|
| 532 |
step=0.1,
|
| 533 |
+
value=1.0
|
| 534 |
)
|
| 535 |
num_inference_steps = gr.Slider(
|
| 536 |
label="Inference Steps",
|
|
|
|
| 563 |
"Prompt details will appear after generation. Ability to edit Preset Prompts on the fly will be implemented shortly.</div>"
|
| 564 |
)
|
| 565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 566 |
# Function to show preset editor when a preset is selected
|
| 567 |
def show_preset_editor(preset_type):
|
| 568 |
if preset_type and preset_type in PRESETS:
|