Commit ·
abbdf7a
1
Parent(s): ade8844
Update all result galleries to use filepath type for proper image handling
Browse files- ui/shared/hires_fix_ui.py +103 -103
- ui/shared/img2img_ui.py +85 -85
- ui/shared/inpaint_ui.py +118 -118
- ui/shared/outpaint_ui.py +100 -100
ui/shared/hires_fix_ui.py
CHANGED
|
@@ -1,104 +1,104 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 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_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 |
-
)
|
| 12 |
-
|
| 13 |
-
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 14 |
-
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 15 |
-
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 16 |
-
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 17 |
-
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 18 |
-
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 19 |
-
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 20 |
-
|
| 21 |
-
def create_ui():
|
| 22 |
-
prefix = "hires_fix"
|
| 23 |
-
components = {}
|
| 24 |
-
|
| 25 |
-
with gr.Column():
|
| 26 |
-
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
-
|
| 28 |
-
with gr.Row():
|
| 29 |
-
components.update(create_category_filter_ui(prefix))
|
| 30 |
-
components[f'base_model_{prefix}'] = gr.Dropdown(
|
| 31 |
-
label="Base Model",
|
| 32 |
-
choices=list(MODEL_MAP_CHECKPOINT.keys()),
|
| 33 |
-
value=list(MODEL_MAP_CHECKPOINT.keys())[0],
|
| 34 |
-
scale=3,
|
| 35 |
-
allow_custom_value=True
|
| 36 |
-
)
|
| 37 |
-
with gr.Column(scale=1):
|
| 38 |
-
components[f'run_{prefix}'] = gr.Button("Run Hires. Fix", variant="primary")
|
| 39 |
-
|
| 40 |
-
with gr.Row():
|
| 41 |
-
with gr.Column(scale=1):
|
| 42 |
-
components[f'input_image_{prefix}'] = gr.Image(type="pil", label="Input Image", height=255)
|
| 43 |
-
with gr.Column(scale=2):
|
| 44 |
-
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3, value=DEFAULT_POS_PROMPT)
|
| 45 |
-
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3, value=DEFAULT_NEG_PROMPT)
|
| 46 |
-
|
| 47 |
-
with gr.Row():
|
| 48 |
-
with gr.Column(scale=1):
|
| 49 |
-
with gr.Row():
|
| 50 |
-
components[f'hires_upscaler_{prefix}'] = gr.Dropdown(
|
| 51 |
-
label="Upscaler",
|
| 52 |
-
choices=["nearest-exact", "bilinear", "area", "bicubic", "bislerp"],
|
| 53 |
-
value="nearest-exact"
|
| 54 |
-
)
|
| 55 |
-
components[f'hires_scale_by_{prefix}'] = gr.Slider(
|
| 56 |
-
label="Upscale by", minimum=1.0, maximum=4.0, step=0.1, value=1.5
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
with gr.Row():
|
| 60 |
-
components[f'denoise_{prefix}'] = gr.Slider(label="Denoise Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.55)
|
| 61 |
-
|
| 62 |
-
with gr.Row():
|
| 63 |
-
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 64 |
-
label="Sampler",
|
| 65 |
-
choices=SAMPLER_CHOICES,
|
| 66 |
-
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 67 |
-
)
|
| 68 |
-
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 69 |
-
label="Scheduler",
|
| 70 |
-
choices=SCHEDULER_CHOICES,
|
| 71 |
-
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 72 |
-
)
|
| 73 |
-
with gr.Row():
|
| 74 |
-
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 75 |
-
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 76 |
-
with gr.Row():
|
| 77 |
-
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 78 |
-
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 79 |
-
with gr.Row():
|
| 80 |
-
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 81 |
-
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 82 |
-
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
|
| 83 |
-
|
| 84 |
-
components[f'width_{prefix}'] = gr.State(value=512)
|
| 85 |
-
components[f'height_{prefix}'] = gr.State(value=512)
|
| 86 |
-
|
| 87 |
-
with gr.Column(scale=1):
|
| 88 |
-
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1,
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
components.update(create_lora_settings_ui(prefix))
|
| 92 |
-
components.update(create_controlnet_ui(prefix))
|
| 93 |
-
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 94 |
-
components.update(create_ipadapter_ui(prefix))
|
| 95 |
-
components.update(create_flux1_ipadapter_ui(prefix))
|
| 96 |
-
components.update(create_sd3_ipadapter_ui(prefix))
|
| 97 |
-
components.update(create_style_ui(prefix))
|
| 98 |
-
components.update(create_embedding_ui(prefix))
|
| 99 |
-
components.update(create_conditioning_ui(prefix))
|
| 100 |
-
components.update(create_reference_latent_ui(prefix))
|
| 101 |
-
components.update(create_hidream_o1_reference_ui(prefix))
|
| 102 |
-
components.update(create_vae_override_ui(prefix))
|
| 103 |
-
|
| 104 |
return components
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 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_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 |
+
)
|
| 12 |
+
|
| 13 |
+
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 14 |
+
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 15 |
+
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 16 |
+
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 17 |
+
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 18 |
+
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 19 |
+
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 20 |
+
|
| 21 |
+
def create_ui():
|
| 22 |
+
prefix = "hires_fix"
|
| 23 |
+
components = {}
|
| 24 |
+
|
| 25 |
+
with gr.Column():
|
| 26 |
+
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
+
|
| 28 |
+
with gr.Row():
|
| 29 |
+
components.update(create_category_filter_ui(prefix))
|
| 30 |
+
components[f'base_model_{prefix}'] = gr.Dropdown(
|
| 31 |
+
label="Base Model",
|
| 32 |
+
choices=list(MODEL_MAP_CHECKPOINT.keys()),
|
| 33 |
+
value=list(MODEL_MAP_CHECKPOINT.keys())[0],
|
| 34 |
+
scale=3,
|
| 35 |
+
allow_custom_value=True
|
| 36 |
+
)
|
| 37 |
+
with gr.Column(scale=1):
|
| 38 |
+
components[f'run_{prefix}'] = gr.Button("Run Hires. Fix", variant="primary")
|
| 39 |
+
|
| 40 |
+
with gr.Row():
|
| 41 |
+
with gr.Column(scale=1):
|
| 42 |
+
components[f'input_image_{prefix}'] = gr.Image(type="pil", label="Input Image", height=255)
|
| 43 |
+
with gr.Column(scale=2):
|
| 44 |
+
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3, value=DEFAULT_POS_PROMPT)
|
| 45 |
+
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3, value=DEFAULT_NEG_PROMPT)
|
| 46 |
+
|
| 47 |
+
with gr.Row():
|
| 48 |
+
with gr.Column(scale=1):
|
| 49 |
+
with gr.Row():
|
| 50 |
+
components[f'hires_upscaler_{prefix}'] = gr.Dropdown(
|
| 51 |
+
label="Upscaler",
|
| 52 |
+
choices=["nearest-exact", "bilinear", "area", "bicubic", "bislerp"],
|
| 53 |
+
value="nearest-exact"
|
| 54 |
+
)
|
| 55 |
+
components[f'hires_scale_by_{prefix}'] = gr.Slider(
|
| 56 |
+
label="Upscale by", minimum=1.0, maximum=4.0, step=0.1, value=1.5
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
with gr.Row():
|
| 60 |
+
components[f'denoise_{prefix}'] = gr.Slider(label="Denoise Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.55)
|
| 61 |
+
|
| 62 |
+
with gr.Row():
|
| 63 |
+
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 64 |
+
label="Sampler",
|
| 65 |
+
choices=SAMPLER_CHOICES,
|
| 66 |
+
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 67 |
+
)
|
| 68 |
+
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 69 |
+
label="Scheduler",
|
| 70 |
+
choices=SCHEDULER_CHOICES,
|
| 71 |
+
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 72 |
+
)
|
| 73 |
+
with gr.Row():
|
| 74 |
+
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 75 |
+
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 76 |
+
with gr.Row():
|
| 77 |
+
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 78 |
+
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 79 |
+
with gr.Row():
|
| 80 |
+
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 81 |
+
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 82 |
+
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
|
| 83 |
+
|
| 84 |
+
components[f'width_{prefix}'] = gr.State(value=512)
|
| 85 |
+
components[f'height_{prefix}'] = gr.State(value=512)
|
| 86 |
+
|
| 87 |
+
with gr.Column(scale=1):
|
| 88 |
+
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1, type="filepath", height=610)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
components.update(create_lora_settings_ui(prefix))
|
| 92 |
+
components.update(create_controlnet_ui(prefix))
|
| 93 |
+
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 94 |
+
components.update(create_ipadapter_ui(prefix))
|
| 95 |
+
components.update(create_flux1_ipadapter_ui(prefix))
|
| 96 |
+
components.update(create_sd3_ipadapter_ui(prefix))
|
| 97 |
+
components.update(create_style_ui(prefix))
|
| 98 |
+
components.update(create_embedding_ui(prefix))
|
| 99 |
+
components.update(create_conditioning_ui(prefix))
|
| 100 |
+
components.update(create_reference_latent_ui(prefix))
|
| 101 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 102 |
+
components.update(create_vae_override_ui(prefix))
|
| 103 |
+
|
| 104 |
return components
|
ui/shared/img2img_ui.py
CHANGED
|
@@ -1,86 +1,86 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 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 |
-
)
|
| 12 |
-
|
| 13 |
-
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 14 |
-
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 15 |
-
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 16 |
-
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 17 |
-
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 18 |
-
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 19 |
-
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 20 |
-
|
| 21 |
-
def create_ui():
|
| 22 |
-
prefix = "img2img"
|
| 23 |
-
components = {}
|
| 24 |
-
|
| 25 |
-
with gr.Column():
|
| 26 |
-
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
-
|
| 28 |
-
with gr.Row():
|
| 29 |
-
components.update(create_category_filter_ui(prefix))
|
| 30 |
-
components[f'base_model_{prefix}'] = gr.Dropdown(label="Base Model", choices=list(MODEL_MAP_CHECKPOINT.keys()), value=list(MODEL_MAP_CHECKPOINT.keys())[0], scale=3, allow_custom_value=True)
|
| 31 |
-
with gr.Column(scale=1):
|
| 32 |
-
components[f'run_{prefix}'] = gr.Button("Run", variant="primary")
|
| 33 |
-
|
| 34 |
-
with gr.Row():
|
| 35 |
-
with gr.Column(scale=1):
|
| 36 |
-
components[f'input_image_{prefix}'] = gr.Image(type="pil", label="Input Image", height=255)
|
| 37 |
-
|
| 38 |
-
with gr.Column(scale=2):
|
| 39 |
-
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3, value=DEFAULT_POS_PROMPT)
|
| 40 |
-
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3, value=DEFAULT_NEG_PROMPT)
|
| 41 |
-
|
| 42 |
-
with gr.Row():
|
| 43 |
-
with gr.Column(scale=1):
|
| 44 |
-
components[f'denoise_{prefix}'] = gr.Slider(label="Denoise Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.7)
|
| 45 |
-
|
| 46 |
-
with gr.Row():
|
| 47 |
-
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 48 |
-
label="Sampler",
|
| 49 |
-
choices=SAMPLER_CHOICES,
|
| 50 |
-
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 51 |
-
)
|
| 52 |
-
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 53 |
-
label="Scheduler",
|
| 54 |
-
choices=SCHEDULER_CHOICES,
|
| 55 |
-
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 56 |
-
)
|
| 57 |
-
with gr.Row():
|
| 58 |
-
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 59 |
-
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 60 |
-
with gr.Row():
|
| 61 |
-
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 62 |
-
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 63 |
-
with gr.Row():
|
| 64 |
-
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 65 |
-
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 66 |
-
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU. Longer jobs may need more time.")
|
| 67 |
-
|
| 68 |
-
with gr.Column(scale=1):
|
| 69 |
-
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1,
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
components.update(create_lora_settings_ui(prefix))
|
| 73 |
-
components.update(create_controlnet_ui(prefix))
|
| 74 |
-
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 75 |
-
components.update(create_diffsynth_controlnet_ui(prefix))
|
| 76 |
-
components.update(create_ipadapter_ui(prefix))
|
| 77 |
-
components.update(create_flux1_ipadapter_ui(prefix))
|
| 78 |
-
components.update(create_sd3_ipadapter_ui(prefix))
|
| 79 |
-
components.update(create_embedding_ui(prefix))
|
| 80 |
-
components.update(create_style_ui(prefix))
|
| 81 |
-
components.update(create_conditioning_ui(prefix))
|
| 82 |
-
components.update(create_reference_latent_ui(prefix))
|
| 83 |
-
components.update(create_hidream_o1_reference_ui(prefix))
|
| 84 |
-
components.update(create_vae_override_ui(prefix))
|
| 85 |
-
|
| 86 |
return components
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 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 |
+
)
|
| 12 |
+
|
| 13 |
+
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 14 |
+
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 15 |
+
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 16 |
+
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 17 |
+
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 18 |
+
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 19 |
+
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 20 |
+
|
| 21 |
+
def create_ui():
|
| 22 |
+
prefix = "img2img"
|
| 23 |
+
components = {}
|
| 24 |
+
|
| 25 |
+
with gr.Column():
|
| 26 |
+
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
+
|
| 28 |
+
with gr.Row():
|
| 29 |
+
components.update(create_category_filter_ui(prefix))
|
| 30 |
+
components[f'base_model_{prefix}'] = gr.Dropdown(label="Base Model", choices=list(MODEL_MAP_CHECKPOINT.keys()), value=list(MODEL_MAP_CHECKPOINT.keys())[0], scale=3, allow_custom_value=True)
|
| 31 |
+
with gr.Column(scale=1):
|
| 32 |
+
components[f'run_{prefix}'] = gr.Button("Run", variant="primary")
|
| 33 |
+
|
| 34 |
+
with gr.Row():
|
| 35 |
+
with gr.Column(scale=1):
|
| 36 |
+
components[f'input_image_{prefix}'] = gr.Image(type="pil", label="Input Image", height=255)
|
| 37 |
+
|
| 38 |
+
with gr.Column(scale=2):
|
| 39 |
+
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3, value=DEFAULT_POS_PROMPT)
|
| 40 |
+
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3, value=DEFAULT_NEG_PROMPT)
|
| 41 |
+
|
| 42 |
+
with gr.Row():
|
| 43 |
+
with gr.Column(scale=1):
|
| 44 |
+
components[f'denoise_{prefix}'] = gr.Slider(label="Denoise Strength", minimum=0.0, maximum=1.0, step=0.01, value=0.7)
|
| 45 |
+
|
| 46 |
+
with gr.Row():
|
| 47 |
+
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 48 |
+
label="Sampler",
|
| 49 |
+
choices=SAMPLER_CHOICES,
|
| 50 |
+
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 51 |
+
)
|
| 52 |
+
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 53 |
+
label="Scheduler",
|
| 54 |
+
choices=SCHEDULER_CHOICES,
|
| 55 |
+
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 56 |
+
)
|
| 57 |
+
with gr.Row():
|
| 58 |
+
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 59 |
+
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 60 |
+
with gr.Row():
|
| 61 |
+
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 62 |
+
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 63 |
+
with gr.Row():
|
| 64 |
+
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 65 |
+
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 66 |
+
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU. Longer jobs may need more time.")
|
| 67 |
+
|
| 68 |
+
with gr.Column(scale=1):
|
| 69 |
+
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1, type="filepath", height=505)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
components.update(create_lora_settings_ui(prefix))
|
| 73 |
+
components.update(create_controlnet_ui(prefix))
|
| 74 |
+
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 75 |
+
components.update(create_diffsynth_controlnet_ui(prefix))
|
| 76 |
+
components.update(create_ipadapter_ui(prefix))
|
| 77 |
+
components.update(create_flux1_ipadapter_ui(prefix))
|
| 78 |
+
components.update(create_sd3_ipadapter_ui(prefix))
|
| 79 |
+
components.update(create_embedding_ui(prefix))
|
| 80 |
+
components.update(create_style_ui(prefix))
|
| 81 |
+
components.update(create_conditioning_ui(prefix))
|
| 82 |
+
components.update(create_reference_latent_ui(prefix))
|
| 83 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 84 |
+
components.update(create_vae_override_ui(prefix))
|
| 85 |
+
|
| 86 |
return components
|
ui/shared/inpaint_ui.py
CHANGED
|
@@ -1,119 +1,119 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 3 |
-
from .ui_components import (
|
| 4 |
-
create_base_parameter_ui, create_lora_settings_ui,
|
| 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 |
-
)
|
| 11 |
-
|
| 12 |
-
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 13 |
-
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 14 |
-
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 15 |
-
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 16 |
-
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 17 |
-
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 18 |
-
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 19 |
-
|
| 20 |
-
def create_ui():
|
| 21 |
-
prefix = "inpaint"
|
| 22 |
-
components = {}
|
| 23 |
-
|
| 24 |
-
with gr.Column():
|
| 25 |
-
with gr.Row() as arch_row:
|
| 26 |
-
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
-
|
| 28 |
-
with gr.Row() as model_and_run_row:
|
| 29 |
-
components.update(create_category_filter_ui(prefix))
|
| 30 |
-
components[f'base_model_{prefix}'] = gr.Dropdown(
|
| 31 |
-
label="Base Model",
|
| 32 |
-
choices=list(MODEL_MAP_CHECKPOINT.keys()),
|
| 33 |
-
value=list(MODEL_MAP_CHECKPOINT.keys())[0],
|
| 34 |
-
scale=3,
|
| 35 |
-
allow_custom_value=True
|
| 36 |
-
)
|
| 37 |
-
with gr.Column(scale=1):
|
| 38 |
-
components[f'run_{prefix}'] = gr.Button("Run Inpaint", variant="primary")
|
| 39 |
-
|
| 40 |
-
components[f'model_and_run_row_{prefix}'] = [arch_row, model_and_run_row]
|
| 41 |
-
|
| 42 |
-
with gr.Row() as main_content_row:
|
| 43 |
-
with gr.Column(scale=1) as editor_column:
|
| 44 |
-
components[f'view_mode_{prefix}'] = gr.Radio(
|
| 45 |
-
["Normal View", "Fullscreen View"],
|
| 46 |
-
label="Editor View",
|
| 47 |
-
value="Normal View",
|
| 48 |
-
interactive=True
|
| 49 |
-
)
|
| 50 |
-
components[f'input_image_dict_{prefix}'] = gr.ImageEditor(
|
| 51 |
-
type="pil",
|
| 52 |
-
label="Image & Mask",
|
| 53 |
-
height=272
|
| 54 |
-
)
|
| 55 |
-
components[f'editor_column_{prefix}'] = editor_column
|
| 56 |
-
|
| 57 |
-
with gr.Column(scale=2) as prompts_column:
|
| 58 |
-
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=6, value=DEFAULT_POS_PROMPT)
|
| 59 |
-
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=6, value=DEFAULT_NEG_PROMPT)
|
| 60 |
-
components[f'prompts_column_{prefix}'] = prompts_column
|
| 61 |
-
|
| 62 |
-
with gr.Row() as params_and_gallery_row:
|
| 63 |
-
with gr.Column(scale=1):
|
| 64 |
-
from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
|
| 65 |
-
with gr.Row():
|
| 66 |
-
components[f'denoise_{prefix}'] = gr.Slider(
|
| 67 |
-
label="Denoise", minimum=0.0, maximum=1.0, step=0.05, value=1.0
|
| 68 |
-
)
|
| 69 |
-
components[f'grow_mask_by_{prefix}'] = gr.Slider(
|
| 70 |
-
label="Grow Mask By", minimum=0, maximum=64, step=1, value=6
|
| 71 |
-
)
|
| 72 |
-
with gr.Row():
|
| 73 |
-
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 74 |
-
label="Sampler",
|
| 75 |
-
choices=SAMPLER_CHOICES,
|
| 76 |
-
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 77 |
-
)
|
| 78 |
-
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 79 |
-
label="Scheduler",
|
| 80 |
-
choices=SCHEDULER_CHOICES,
|
| 81 |
-
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 82 |
-
)
|
| 83 |
-
with gr.Row():
|
| 84 |
-
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 85 |
-
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 86 |
-
with gr.Row():
|
| 87 |
-
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 88 |
-
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 89 |
-
with gr.Row():
|
| 90 |
-
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 91 |
-
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 92 |
-
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
|
| 93 |
-
|
| 94 |
-
components[f'width_{prefix}'] = gr.State(value=512)
|
| 95 |
-
components[f'height_{prefix}'] = gr.State(value=512)
|
| 96 |
-
|
| 97 |
-
with gr.Column(scale=1):
|
| 98 |
-
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1,
|
| 99 |
-
|
| 100 |
-
components[f'params_and_gallery_row_{prefix}'] = params_and_gallery_row
|
| 101 |
-
|
| 102 |
-
with gr.Column() as accordion_wrapper:
|
| 103 |
-
|
| 104 |
-
components.update(create_lora_settings_ui(prefix))
|
| 105 |
-
components.update(create_controlnet_ui(prefix))
|
| 106 |
-
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 107 |
-
components.update(create_diffsynth_controlnet_ui(prefix))
|
| 108 |
-
components.update(create_ipadapter_ui(prefix))
|
| 109 |
-
components.update(create_flux1_ipadapter_ui(prefix))
|
| 110 |
-
components.update(create_sd3_ipadapter_ui(prefix))
|
| 111 |
-
components.update(create_style_ui(prefix))
|
| 112 |
-
components.update(create_embedding_ui(prefix))
|
| 113 |
-
components.update(create_conditioning_ui(prefix))
|
| 114 |
-
components.update(create_reference_latent_ui(prefix))
|
| 115 |
-
components.update(create_hidream_o1_reference_ui(prefix))
|
| 116 |
-
components.update(create_vae_override_ui(prefix))
|
| 117 |
-
components[f'accordion_wrapper_{prefix}'] = accordion_wrapper
|
| 118 |
-
|
| 119 |
return components
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 3 |
+
from .ui_components import (
|
| 4 |
+
create_base_parameter_ui, create_lora_settings_ui,
|
| 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 |
+
)
|
| 11 |
+
|
| 12 |
+
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 13 |
+
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 14 |
+
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 15 |
+
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 16 |
+
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 17 |
+
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 18 |
+
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 19 |
+
|
| 20 |
+
def create_ui():
|
| 21 |
+
prefix = "inpaint"
|
| 22 |
+
components = {}
|
| 23 |
+
|
| 24 |
+
with gr.Column():
|
| 25 |
+
with gr.Row() as arch_row:
|
| 26 |
+
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
+
|
| 28 |
+
with gr.Row() as model_and_run_row:
|
| 29 |
+
components.update(create_category_filter_ui(prefix))
|
| 30 |
+
components[f'base_model_{prefix}'] = gr.Dropdown(
|
| 31 |
+
label="Base Model",
|
| 32 |
+
choices=list(MODEL_MAP_CHECKPOINT.keys()),
|
| 33 |
+
value=list(MODEL_MAP_CHECKPOINT.keys())[0],
|
| 34 |
+
scale=3,
|
| 35 |
+
allow_custom_value=True
|
| 36 |
+
)
|
| 37 |
+
with gr.Column(scale=1):
|
| 38 |
+
components[f'run_{prefix}'] = gr.Button("Run Inpaint", variant="primary")
|
| 39 |
+
|
| 40 |
+
components[f'model_and_run_row_{prefix}'] = [arch_row, model_and_run_row]
|
| 41 |
+
|
| 42 |
+
with gr.Row() as main_content_row:
|
| 43 |
+
with gr.Column(scale=1) as editor_column:
|
| 44 |
+
components[f'view_mode_{prefix}'] = gr.Radio(
|
| 45 |
+
["Normal View", "Fullscreen View"],
|
| 46 |
+
label="Editor View",
|
| 47 |
+
value="Normal View",
|
| 48 |
+
interactive=True
|
| 49 |
+
)
|
| 50 |
+
components[f'input_image_dict_{prefix}'] = gr.ImageEditor(
|
| 51 |
+
type="pil",
|
| 52 |
+
label="Image & Mask",
|
| 53 |
+
height=272
|
| 54 |
+
)
|
| 55 |
+
components[f'editor_column_{prefix}'] = editor_column
|
| 56 |
+
|
| 57 |
+
with gr.Column(scale=2) as prompts_column:
|
| 58 |
+
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=6, value=DEFAULT_POS_PROMPT)
|
| 59 |
+
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=6, value=DEFAULT_NEG_PROMPT)
|
| 60 |
+
components[f'prompts_column_{prefix}'] = prompts_column
|
| 61 |
+
|
| 62 |
+
with gr.Row() as params_and_gallery_row:
|
| 63 |
+
with gr.Column(scale=1):
|
| 64 |
+
from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICES
|
| 65 |
+
with gr.Row():
|
| 66 |
+
components[f'denoise_{prefix}'] = gr.Slider(
|
| 67 |
+
label="Denoise", minimum=0.0, maximum=1.0, step=0.05, value=1.0
|
| 68 |
+
)
|
| 69 |
+
components[f'grow_mask_by_{prefix}'] = gr.Slider(
|
| 70 |
+
label="Grow Mask By", minimum=0, maximum=64, step=1, value=6
|
| 71 |
+
)
|
| 72 |
+
with gr.Row():
|
| 73 |
+
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 74 |
+
label="Sampler",
|
| 75 |
+
choices=SAMPLER_CHOICES,
|
| 76 |
+
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 77 |
+
)
|
| 78 |
+
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 79 |
+
label="Scheduler",
|
| 80 |
+
choices=SCHEDULER_CHOICES,
|
| 81 |
+
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 82 |
+
)
|
| 83 |
+
with gr.Row():
|
| 84 |
+
components[f'steps_{prefix}'] = gr.Slider(label="Steps", minimum=1, maximum=100, step=1, value=DEFAULT_STEPS)
|
| 85 |
+
components[f'cfg_{prefix}'] = gr.Slider(label="CFG Scale", minimum=1.0, maximum=20.0, step=0.1, value=DEFAULT_CFG)
|
| 86 |
+
with gr.Row():
|
| 87 |
+
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 88 |
+
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 89 |
+
with gr.Row():
|
| 90 |
+
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 91 |
+
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 92 |
+
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
|
| 93 |
+
|
| 94 |
+
components[f'width_{prefix}'] = gr.State(value=512)
|
| 95 |
+
components[f'height_{prefix}'] = gr.State(value=512)
|
| 96 |
+
|
| 97 |
+
with gr.Column(scale=1):
|
| 98 |
+
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1, type="filepath", height=510)
|
| 99 |
+
|
| 100 |
+
components[f'params_and_gallery_row_{prefix}'] = params_and_gallery_row
|
| 101 |
+
|
| 102 |
+
with gr.Column() as accordion_wrapper:
|
| 103 |
+
|
| 104 |
+
components.update(create_lora_settings_ui(prefix))
|
| 105 |
+
components.update(create_controlnet_ui(prefix))
|
| 106 |
+
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 107 |
+
components.update(create_diffsynth_controlnet_ui(prefix))
|
| 108 |
+
components.update(create_ipadapter_ui(prefix))
|
| 109 |
+
components.update(create_flux1_ipadapter_ui(prefix))
|
| 110 |
+
components.update(create_sd3_ipadapter_ui(prefix))
|
| 111 |
+
components.update(create_style_ui(prefix))
|
| 112 |
+
components.update(create_embedding_ui(prefix))
|
| 113 |
+
components.update(create_conditioning_ui(prefix))
|
| 114 |
+
components.update(create_reference_latent_ui(prefix))
|
| 115 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 116 |
+
components.update(create_vae_override_ui(prefix))
|
| 117 |
+
components[f'accordion_wrapper_{prefix}'] = accordion_wrapper
|
| 118 |
+
|
| 119 |
return components
|
ui/shared/outpaint_ui.py
CHANGED
|
@@ -1,101 +1,101 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 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 |
-
)
|
| 12 |
-
|
| 13 |
-
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 14 |
-
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 15 |
-
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 16 |
-
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 17 |
-
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 18 |
-
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 19 |
-
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 20 |
-
|
| 21 |
-
def create_ui():
|
| 22 |
-
prefix = "outpaint"
|
| 23 |
-
components = {}
|
| 24 |
-
|
| 25 |
-
with gr.Column():
|
| 26 |
-
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
-
|
| 28 |
-
with gr.Row():
|
| 29 |
-
components.update(create_category_filter_ui(prefix))
|
| 30 |
-
components[f'base_model_{prefix}'] = gr.Dropdown(
|
| 31 |
-
label="Base Model",
|
| 32 |
-
choices=list(MODEL_MAP_CHECKPOINT.keys()),
|
| 33 |
-
value=list(MODEL_MAP_CHECKPOINT.keys())[0],
|
| 34 |
-
scale=3,
|
| 35 |
-
allow_custom_value=True
|
| 36 |
-
)
|
| 37 |
-
with gr.Column(scale=1):
|
| 38 |
-
components[f'run_{prefix}'] = gr.Button("Run Outpaint", variant="primary")
|
| 39 |
-
|
| 40 |
-
with gr.Row():
|
| 41 |
-
with gr.Column(scale=1):
|
| 42 |
-
components[f'input_image_{prefix}'] = gr.Image(type="pil", label="Input Image", height=255)
|
| 43 |
-
with gr.Column(scale=2):
|
| 44 |
-
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3, value=DEFAULT_POS_PROMPT)
|
| 45 |
-
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3, value=DEFAULT_NEG_PROMPT)
|
| 46 |
-
|
| 47 |
-
with gr.Row():
|
| 48 |
-
with gr.Column(scale=1):
|
| 49 |
-
with gr.Row():
|
| 50 |
-
components[f'left_{prefix}'] = gr.Slider(label="Pad Left", minimum=0, maximum=512, step=64, value=64)
|
| 51 |
-
components[f'right_{prefix}'] = gr.Slider(label="Pad Right", minimum=0, maximum=512, step=64, value=64)
|
| 52 |
-
with gr.Row():
|
| 53 |
-
components[f'top_{prefix}'] = gr.Slider(label="Pad Top", minimum=0, maximum=512, step=64, value=64)
|
| 54 |
-
components[f'bottom_{prefix}'] = gr.Slider(label="Pad Bottom", minimum=0, maximum=512, step=64, value=64)
|
| 55 |
-
|
| 56 |
-
components[f'feathering_{prefix}'] = gr.Slider(label="Feathering / Grow Mask", minimum=0, maximum=100, step=1, value=10)
|
| 57 |
-
|
| 58 |
-
with gr.Row():
|
| 59 |
-
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 60 |
-
label="Sampler",
|
| 61 |
-
choices=SAMPLER_CHOICES,
|
| 62 |
-
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 63 |
-
)
|
| 64 |
-
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 65 |
-
label="Scheduler",
|
| 66 |
-
choices=SCHEDULER_CHOICES,
|
| 67 |
-
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 68 |
-
)
|
| 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 |
-
with gr.Row():
|
| 73 |
-
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 74 |
-
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 75 |
-
with gr.Row():
|
| 76 |
-
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 77 |
-
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 78 |
-
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
|
| 79 |
-
|
| 80 |
-
components[f'width_{prefix}'] = gr.State(value=512)
|
| 81 |
-
components[f'height_{prefix}'] = gr.State(value=512)
|
| 82 |
-
|
| 83 |
-
with gr.Column(scale=1):
|
| 84 |
-
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1,
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
components.update(create_lora_settings_ui(prefix))
|
| 88 |
-
components.update(create_controlnet_ui(prefix))
|
| 89 |
-
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 90 |
-
components.update(create_diffsynth_controlnet_ui(prefix))
|
| 91 |
-
components.update(create_ipadapter_ui(prefix))
|
| 92 |
-
components.update(create_flux1_ipadapter_ui(prefix))
|
| 93 |
-
components.update(create_sd3_ipadapter_ui(prefix))
|
| 94 |
-
components.update(create_style_ui(prefix))
|
| 95 |
-
components.update(create_embedding_ui(prefix))
|
| 96 |
-
components.update(create_conditioning_ui(prefix))
|
| 97 |
-
components.update(create_reference_latent_ui(prefix))
|
| 98 |
-
components.update(create_hidream_o1_reference_ui(prefix))
|
| 99 |
-
components.update(create_vae_override_ui(prefix))
|
| 100 |
-
|
| 101 |
return components
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from core.settings import MODEL_MAP_CHECKPOINT, MODEL_DEFAULTS_CONFIG
|
| 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 |
+
)
|
| 12 |
+
|
| 13 |
+
default_vals = MODEL_DEFAULTS_CONFIG.get('Default', {})
|
| 14 |
+
DEFAULT_STEPS = default_vals.get('steps', 20)
|
| 15 |
+
DEFAULT_CFG = default_vals.get('cfg', 5.0)
|
| 16 |
+
DEFAULT_SAMPLER = default_vals.get('sampler_name', 'euler')
|
| 17 |
+
DEFAULT_SCHEDULER = default_vals.get('scheduler', 'simple')
|
| 18 |
+
DEFAULT_POS_PROMPT = default_vals.get('positive_prompt', '')
|
| 19 |
+
DEFAULT_NEG_PROMPT = default_vals.get('negative_prompt', '')
|
| 20 |
+
|
| 21 |
+
def create_ui():
|
| 22 |
+
prefix = "outpaint"
|
| 23 |
+
components = {}
|
| 24 |
+
|
| 25 |
+
with gr.Column():
|
| 26 |
+
components.update(create_model_architecture_filter_ui(prefix))
|
| 27 |
+
|
| 28 |
+
with gr.Row():
|
| 29 |
+
components.update(create_category_filter_ui(prefix))
|
| 30 |
+
components[f'base_model_{prefix}'] = gr.Dropdown(
|
| 31 |
+
label="Base Model",
|
| 32 |
+
choices=list(MODEL_MAP_CHECKPOINT.keys()),
|
| 33 |
+
value=list(MODEL_MAP_CHECKPOINT.keys())[0],
|
| 34 |
+
scale=3,
|
| 35 |
+
allow_custom_value=True
|
| 36 |
+
)
|
| 37 |
+
with gr.Column(scale=1):
|
| 38 |
+
components[f'run_{prefix}'] = gr.Button("Run Outpaint", variant="primary")
|
| 39 |
+
|
| 40 |
+
with gr.Row():
|
| 41 |
+
with gr.Column(scale=1):
|
| 42 |
+
components[f'input_image_{prefix}'] = gr.Image(type="pil", label="Input Image", height=255)
|
| 43 |
+
with gr.Column(scale=2):
|
| 44 |
+
components[f'prompt_{prefix}'] = gr.Text(label="Prompt", lines=3, value=DEFAULT_POS_PROMPT)
|
| 45 |
+
components[f'neg_prompt_{prefix}'] = gr.Text(label="Negative prompt", lines=3, value=DEFAULT_NEG_PROMPT)
|
| 46 |
+
|
| 47 |
+
with gr.Row():
|
| 48 |
+
with gr.Column(scale=1):
|
| 49 |
+
with gr.Row():
|
| 50 |
+
components[f'left_{prefix}'] = gr.Slider(label="Pad Left", minimum=0, maximum=512, step=64, value=64)
|
| 51 |
+
components[f'right_{prefix}'] = gr.Slider(label="Pad Right", minimum=0, maximum=512, step=64, value=64)
|
| 52 |
+
with gr.Row():
|
| 53 |
+
components[f'top_{prefix}'] = gr.Slider(label="Pad Top", minimum=0, maximum=512, step=64, value=64)
|
| 54 |
+
components[f'bottom_{prefix}'] = gr.Slider(label="Pad Bottom", minimum=0, maximum=512, step=64, value=64)
|
| 55 |
+
|
| 56 |
+
components[f'feathering_{prefix}'] = gr.Slider(label="Feathering / Grow Mask", minimum=0, maximum=100, step=1, value=10)
|
| 57 |
+
|
| 58 |
+
with gr.Row():
|
| 59 |
+
components[f'sampler_{prefix}'] = gr.Dropdown(
|
| 60 |
+
label="Sampler",
|
| 61 |
+
choices=SAMPLER_CHOICES,
|
| 62 |
+
value=DEFAULT_SAMPLER if DEFAULT_SAMPLER in SAMPLER_CHOICES else (SAMPLER_CHOICES[0] if SAMPLER_CHOICES else 'euler')
|
| 63 |
+
)
|
| 64 |
+
components[f'scheduler_{prefix}'] = gr.Dropdown(
|
| 65 |
+
label="Scheduler",
|
| 66 |
+
choices=SCHEDULER_CHOICES,
|
| 67 |
+
value=DEFAULT_SCHEDULER if DEFAULT_SCHEDULER in SCHEDULER_CHOICES else (SCHEDULER_CHOICES[0] if SCHEDULER_CHOICES else 'simple')
|
| 68 |
+
)
|
| 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 |
+
with gr.Row():
|
| 73 |
+
components[f'seed_{prefix}'] = gr.Number(label="Seed (-1 for random)", value=-1, precision=0)
|
| 74 |
+
components[f'batch_size_{prefix}'] = gr.Slider(label="Batch Size", minimum=1, maximum=16, step=1, value=1)
|
| 75 |
+
with gr.Row():
|
| 76 |
+
components[f'clip_skip_{prefix}'] = gr.Slider(label="Clip Skip", minimum=1, maximum=2, step=1, value=1, visible=False, interactive=True)
|
| 77 |
+
components[f'guidance_{prefix}'] = gr.Slider(label="Guidance (FLUX)", minimum=1.0, maximum=10.0, step=0.1, value=3.5, visible=False, interactive=True)
|
| 78 |
+
components[f'zero_gpu_{prefix}'] = gr.Number(label="ZeroGPU Duration (s)", value=None, placeholder="Default: 60s, Max: 120s", info="Optional: Set how long to reserve the GPU.")
|
| 79 |
+
|
| 80 |
+
components[f'width_{prefix}'] = gr.State(value=512)
|
| 81 |
+
components[f'height_{prefix}'] = gr.State(value=512)
|
| 82 |
+
|
| 83 |
+
with gr.Column(scale=1):
|
| 84 |
+
components[f'result_{prefix}'] = gr.Gallery(label="Result", show_label=False, columns=1, type="filepath", height=685)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
components.update(create_lora_settings_ui(prefix))
|
| 88 |
+
components.update(create_controlnet_ui(prefix))
|
| 89 |
+
components.update(create_anima_controlnet_lllite_ui(prefix))
|
| 90 |
+
components.update(create_diffsynth_controlnet_ui(prefix))
|
| 91 |
+
components.update(create_ipadapter_ui(prefix))
|
| 92 |
+
components.update(create_flux1_ipadapter_ui(prefix))
|
| 93 |
+
components.update(create_sd3_ipadapter_ui(prefix))
|
| 94 |
+
components.update(create_style_ui(prefix))
|
| 95 |
+
components.update(create_embedding_ui(prefix))
|
| 96 |
+
components.update(create_conditioning_ui(prefix))
|
| 97 |
+
components.update(create_reference_latent_ui(prefix))
|
| 98 |
+
components.update(create_hidream_o1_reference_ui(prefix))
|
| 99 |
+
components.update(create_vae_override_ui(prefix))
|
| 100 |
+
|
| 101 |
return components
|