Commit ·
21ff072
1
Parent(s): 13176a0
Separate result gallery into right column and split parameter blocks as requested
Browse files- ui/shared/txt2img_ui.py +51 -42
ui/shared/txt2img_ui.py
CHANGED
|
@@ -37,49 +37,58 @@ def create_ui():
|
|
| 37 |
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3)
|
| 38 |
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3)
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
param_defaults = {'w': 1024, 'h': 1024, 'cs_vis': False, 'cs_val': 1}
|
| 42 |
-
# Aspect Ratio block
|
| 43 |
-
components[f'aspect_ratio_{prefix}'] = gr.Dropdown(
|
| 44 |
-
label="Aspect Ratio",
|
| 45 |
-
choices=list(RESOLUTION_MAP.get('sdxl', {}).keys()),
|
| 46 |
-
value="1:1 (Square)",
|
| 47 |
-
interactive=True,
|
| 48 |
-
allow_custom_value=True,
|
| 49 |
-
)
|
| 50 |
-
# Width & Height block
|
| 51 |
with gr.Row():
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
|
| 85 |
components.update(create_lora_settings_ui(prefix))
|
|
|
|
| 37 |
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3)
|
| 38 |
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3)
|
| 39 |
|
| 40 |
+
# Layout: left column – parameter blocks; right column – result gallery (same height as left)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
with gr.Row():
|
| 42 |
+
# LEFT: all parameter blocks stacked vertically
|
| 43 |
+
with gr.Column():
|
| 44 |
+
# Aspect Ratio block
|
| 45 |
+
components[f'aspect_ratio_{prefix}'] = gr.Dropdown(
|
| 46 |
+
label="Aspect Ratio",
|
| 47 |
+
choices=list(RESOLUTION_MAP.get('sdxl', {}).keys()),
|
| 48 |
+
value="1:1 (Square)",
|
| 49 |
+
interactive=True,
|
| 50 |
+
allow_custom_value=True,
|
| 51 |
+
)
|
| 52 |
+
# Width & Height block
|
| 53 |
+
with gr.Row():
|
| 54 |
+
components[f'width_{prefix}'] = gr.Number(label="Width", value=1024, interactive=True)
|
| 55 |
+
components[f'height_{prefix}'] = gr.Number(label="Height", value=1024, interactive=True)
|
| 56 |
+
# Sampler & Scheduler block
|
| 57 |
+
with gr.Row():
|
| 58 |
+
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 59 |
+
label="Sampler",
|
| 60 |
+
choices=SAMPLER_CHOICES,
|
| 61 |
+
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 62 |
+
)
|
| 63 |
+
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 64 |
+
label="Scheduler",
|
| 65 |
+
choices=SCHEDULER_CHOICES,
|
| 66 |
+
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 67 |
+
)
|
| 68 |
+
# Steps & CFG Scale block
|
| 69 |
+
with gr.Row():
|
| 70 |
+
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 71 |
+
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 72 |
+
# Seed & Batch Size block
|
| 73 |
+
with gr.Row():
|
| 74 |
+
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 75 |
+
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 76 |
+
# ZeroGPU Duration block
|
| 77 |
+
components[f'zero_gpu_{prefix}'] = gr.Number(
|
| 78 |
+
label="ZeroGPU Duration (s)",
|
| 79 |
+
value=None,
|
| 80 |
+
placeholder="Default: 60s, Max: 120s",
|
| 81 |
+
info="Optional: Set how long to reserve the GPU."
|
| 82 |
+
)
|
| 83 |
+
# RIGHT: result gallery – height matches combined left column height
|
| 84 |
+
with gr.Column():
|
| 85 |
+
components[f'result_{prefix}'] = gr.Gallery(
|
| 86 |
+
label="Result",
|
| 87 |
+
show_label=False,
|
| 88 |
+
columns=2,
|
| 89 |
+
object_fit="contain",
|
| 90 |
+
height=627
|
| 91 |
+
)
|
| 92 |
|
| 93 |
|
| 94 |
components.update(create_lora_settings_ui(prefix))
|