Commit ·
13176a0
1
Parent(s): 0bc0cb4
Split Txt2Img base parameters into separate blocks as requested
Browse files- ui/shared/txt2img_ui.py +45 -7
ui/shared/txt2img_ui.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from core.settings import MODEL_MAP_CHECKPOINT
|
|
|
|
| 3 |
from .ui_components import (
|
| 4 |
-
|
| 5 |
create_controlnet_ui, create_anima_controlnet_lllite_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
|
| 6 |
create_conditioning_ui, create_vae_override_ui,
|
| 7 |
create_model_architecture_filter_ui, create_category_filter_ui,
|
| 8 |
create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
|
| 9 |
create_reference_latent_ui, create_hidream_o1_reference_ui,
|
| 10 |
-
create_pid_ui
|
|
|
|
| 11 |
)
|
| 12 |
|
| 13 |
def create_ui():
|
|
@@ -37,11 +39,47 @@ def create_ui():
|
|
| 37 |
|
| 38 |
# Base parameters and result gallery
|
| 39 |
param_defaults = {'w': 1024, 'h': 1024, 'cs_vis': False, 'cs_val': 1}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
with gr.Row():
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
|
| 47 |
components.update(create_lora_settings_ui(prefix))
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from core.settings import MODEL_MAP_CHECKPOINT, RESOLUTION_MAP
|
| 3 |
+
from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
|
| 4 |
from .ui_components import (
|
| 5 |
+
create_lora_settings_ui,
|
| 6 |
create_controlnet_ui, create_anima_controlnet_lllite_ui, create_diffsynth_controlnet_ui, create_ipadapter_ui, create_embedding_ui,
|
| 7 |
create_conditioning_ui, create_vae_override_ui,
|
| 8 |
create_model_architecture_filter_ui, create_category_filter_ui,
|
| 9 |
create_sd3_ipadapter_ui, create_flux1_ipadapter_ui, create_style_ui,
|
| 10 |
create_reference_latent_ui, create_hidream_o1_reference_ui,
|
| 11 |
+
create_pid_ui,
|
| 12 |
+
DEFAULT_SAMPLER, DEFAULT_SCHEDULER, DEFAULT_STEPS, DEFAULT_CFG,
|
| 13 |
)
|
| 14 |
|
| 15 |
def create_ui():
|
|
|
|
| 39 |
|
| 40 |
# Base parameters and result gallery
|
| 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 |
+
components[f'width_{prefix}'] = gr.Number(label="Width", value=param_defaults['w'], interactive=True)
|
| 53 |
+
components[f'height_{prefix}'] = gr.Number(label="Height", value=param_defaults['h'], interactive=True)
|
| 54 |
+
# Sampler & Scheduler block
|
| 55 |
+
with gr.Row():
|
| 56 |
+
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 57 |
+
label="Sampler",
|
| 58 |
+
choices=SAMPLER_CHOICES,
|
| 59 |
+
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 60 |
+
)
|
| 61 |
+
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 62 |
+
label="Scheduler",
|
| 63 |
+
choices=SCHEDULER_CHOICES,
|
| 64 |
+
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 65 |
+
)
|
| 66 |
+
# Steps & CFG Scale block
|
| 67 |
+
with gr.Row():
|
| 68 |
+
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 69 |
+
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 70 |
+
# Seed & Batch Size block
|
| 71 |
+
with gr.Row():
|
| 72 |
+
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 73 |
+
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 74 |
+
# ZeroGPU Duration block
|
| 75 |
+
components[f'zero_gpu_{prefix}'] = gr.Number(
|
| 76 |
+
label="ZeroGPU Duration (s)",
|
| 77 |
+
value=None,
|
| 78 |
+
placeholder="Default: 60s, Max: 120s",
|
| 79 |
+
info="Optional: Set how long to reserve the GPU."
|
| 80 |
+
)
|
| 81 |
+
# Result gallery
|
| 82 |
+
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=2, object_fit="contain", height=627)
|
| 83 |
|
| 84 |
|
| 85 |
components.update(create_lora_settings_ui(prefix))
|