feat: add preset option for default_inpaint_engine_version, revert previous overwrite_step changes
add handling with state to allow overrides with inpaint_mode preset setting (currently disabled)
This commit is contained in:
parent
49d898f6c7
commit
33c22929e4
|
|
@ -533,7 +533,7 @@ example_inpaint_prompts = [[x] for x in example_inpaint_prompts]
|
|||
|
||||
config_dict["default_loras"] = default_loras = default_loras[:default_max_lora_number] + [[True, 'None', 1.0] for _ in range(default_max_lora_number - len(default_loras))]
|
||||
|
||||
# mapping config to meta parameter
|
||||
# mapping config to meta parameter
|
||||
possible_preset_keys = {
|
||||
"default_model": "base_model",
|
||||
"default_refiner": "refiner_model",
|
||||
|
|
@ -562,7 +562,8 @@ possible_preset_keys = {
|
|||
"lora_downloads": "lora_downloads",
|
||||
"vae_downloads": "vae_downloads",
|
||||
"default_vae": "vae",
|
||||
"default_inpaint_method": "inpaint_method"
|
||||
# "default_inpaint_method": "inpaint_method", # disabled so inpaint mode doesn't refresh after every preset change
|
||||
"default_inpaint_engine_version": "inpaint_engine_version",
|
||||
}
|
||||
|
||||
REWRITE_PRESET = False
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ def load_parameter_button_click(raw_metadata: dict | str, is_generating: bool):
|
|||
get_str('scheduler', 'Scheduler', loaded_parameter_dict, results)
|
||||
get_str('vae', 'VAE', loaded_parameter_dict, results)
|
||||
get_seed('seed', 'Seed', loaded_parameter_dict, results)
|
||||
get_inpaint_engine_version('inpaint_engine_version', 'Inpaint Engine Version', loaded_parameter_dict, results)
|
||||
get_inpaint_method('inpaint_method', 'Inpaint Mode', loaded_parameter_dict, results)
|
||||
|
||||
if is_generating:
|
||||
|
|
@ -161,6 +162,19 @@ def get_seed(key: str, fallback: str | None, source_dict: dict, results: list, d
|
|||
results.append(gr.update())
|
||||
|
||||
|
||||
def get_inpaint_engine_version(key: str, fallback: str | None, source_dict: dict, results: list, default=None) -> str | None:
|
||||
try:
|
||||
h = source_dict.get(key, source_dict.get(fallback, default))
|
||||
assert isinstance(h, str) and h in modules.flags.inpaint_engine_versions
|
||||
results.append(h)
|
||||
results.append(h)
|
||||
return h
|
||||
except:
|
||||
results.append(gr.update())
|
||||
results.append('empty')
|
||||
return None
|
||||
|
||||
|
||||
def get_inpaint_method(key: str, fallback: str | None, source_dict: dict, results: list, default=None) -> str | None:
|
||||
try:
|
||||
h = source_dict.get(key, source_dict.get(fallback, default))
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
],
|
||||
"default_aspect_ratio": "896*1152",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": -1,
|
||||
"checkpoint_downloads": {
|
||||
"animaPencilXL_v310.safetensors": "https://huggingface.co/mashb1t/fav_models/resolve/main/fav/animaPencilXL_v310.safetensors"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
],
|
||||
"default_aspect_ratio": "1152*896",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": -1,
|
||||
"checkpoint_downloads": {
|
||||
"juggernautXL_v8Rundiffusion.safetensors": "https://huggingface.co/lllyasviel/fav_models/resolve/main/fav/juggernautXL_v8Rundiffusion.safetensors"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
],
|
||||
"default_aspect_ratio": "1152*896",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": -1,
|
||||
"checkpoint_downloads": {
|
||||
"juggernautXL_v8Rundiffusion.safetensors": "https://huggingface.co/lllyasviel/fav_models/resolve/main/fav/juggernautXL_v8Rundiffusion.safetensors"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@
|
|||
],
|
||||
"default_aspect_ratio": "1024*1024",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": -1,
|
||||
"default_inpaint_method": "Improve Detail (face, hand, eyes, etc.)",
|
||||
"default_inpaint_engine_version": "None",
|
||||
"checkpoint_downloads": {
|
||||
"playground-v2.5-1024px-aesthetic.fp16.safetensors": "https://huggingface.co/mashb1t/fav_models/resolve/main/fav/playground-v2.5-1024px-aesthetic.fp16.safetensors"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"default_model": "ponyDiffusionV6XL.safetensors",
|
||||
"default_refiner": "None",
|
||||
"default_refiner_switch": 1,
|
||||
"default_refiner_switch": 0.5,
|
||||
"default_vae": "ponyDiffusionV6XL_vae.safetensors",
|
||||
"default_loras": [
|
||||
[
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
],
|
||||
"default_aspect_ratio": "896*1152",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": 999,
|
||||
"default_inpaint_engine_version": "None",
|
||||
"checkpoint_downloads": {
|
||||
"ponyDiffusionV6XL.safetensors": "https://huggingface.co/mashb1t/fav_models/resolve/main/fav/ponyDiffusionV6XL.safetensors"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
],
|
||||
"default_aspect_ratio": "896*1152",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": -1,
|
||||
"checkpoint_downloads": {
|
||||
"realisticStockPhoto_v20.safetensors": "https://huggingface.co/lllyasviel/fav_models/resolve/main/fav/realisticStockPhoto_v20.safetensors"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
],
|
||||
"default_aspect_ratio": "1152*896",
|
||||
"default_overwrite_step": -1,
|
||||
"default_overwrite_switch": -1,
|
||||
"checkpoint_downloads": {
|
||||
"sd_xl_base_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors",
|
||||
"sd_xl_refiner_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors"
|
||||
|
|
|
|||
17
webui.py
17
webui.py
|
|
@ -100,6 +100,7 @@ shared.gradio_root = gr.Blocks(title=title).queue()
|
|||
|
||||
with shared.gradio_root:
|
||||
currentTask = gr.State(worker.AsyncTask(args=[]))
|
||||
inpaint_engine_state = gr.State('empty')
|
||||
with gr.Row():
|
||||
with gr.Column(scale=2):
|
||||
with gr.Row():
|
||||
|
|
@ -589,8 +590,8 @@ with shared.gradio_root:
|
|||
overwrite_width, overwrite_height, guidance_scale, sharpness, adm_scaler_positive,
|
||||
adm_scaler_negative, adm_scaler_end, refiner_swap_method, adaptive_cfg, clip_skip,
|
||||
base_model, refiner_model, refiner_switch, sampler_name, scheduler_name, vae_name,
|
||||
seed_random, image_seed, inpaint_mode, generate_button, load_parameter_button
|
||||
] + freeu_ctrls + lora_ctrls
|
||||
seed_random, image_seed, inpaint_engine, inpaint_engine_state, inpaint_mode,
|
||||
generate_button, load_parameter_button] + freeu_ctrls + lora_ctrls
|
||||
|
||||
if not args_manager.args.disable_preset_selection:
|
||||
def preset_selection_change(preset, is_generating):
|
||||
|
|
@ -632,7 +633,7 @@ with shared.gradio_root:
|
|||
queue=False, show_progress=False) \
|
||||
.then(fn=lambda: None, _js='refresh_grid_delayed', queue=False, show_progress=False)
|
||||
|
||||
def inpaint_mode_change(mode):
|
||||
def inpaint_mode_change(mode, inpaint_engine_version):
|
||||
assert mode in modules.flags.inpaint_options
|
||||
|
||||
# inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
||||
|
|
@ -645,28 +646,30 @@ with shared.gradio_root:
|
|||
gr.Dataset.update(visible=True, samples=modules.config.example_inpaint_prompts),
|
||||
False, 'None', 0.5, 0.0
|
||||
]
|
||||
if inpaint_engine_version == 'empty':
|
||||
inpaint_engine_version = modules.config.default_inpaint_engine_version
|
||||
|
||||
if mode == modules.flags.inpaint_option_modify:
|
||||
return [
|
||||
gr.update(visible=True), gr.update(visible=False, value=[]),
|
||||
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
||||
True, modules.config.default_inpaint_engine_version, 1.0, 0.0
|
||||
True, inpaint_engine_version, 1.0, 0.0
|
||||
]
|
||||
|
||||
return [
|
||||
gr.update(visible=False, value=''), gr.update(visible=True),
|
||||
gr.Dataset.update(visible=False, samples=modules.config.example_inpaint_prompts),
|
||||
False, modules.config.default_inpaint_engine_version, 1.0, 0.618
|
||||
False, inpaint_engine_version, 1.0, 0.618
|
||||
]
|
||||
|
||||
inpaint_mode.change(inpaint_mode_change, inputs=inpaint_mode, outputs=[
|
||||
inpaint_mode.change(inpaint_mode_change, inputs=[inpaint_mode, inpaint_engine_state], outputs=[
|
||||
inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
||||
inpaint_disable_initial_latent, inpaint_engine,
|
||||
inpaint_strength, inpaint_respective_field
|
||||
], show_progress=False, queue=False)
|
||||
|
||||
# load configured default_inpaint_method
|
||||
shared.gradio_root.load(inpaint_mode_change, inputs=inpaint_mode, outputs=[
|
||||
shared.gradio_root.load(inpaint_mode_change, inputs=[inpaint_mode, inpaint_engine_state], outputs=[
|
||||
inpaint_additional_prompt, outpaint_selections, example_inpaint_prompts,
|
||||
inpaint_disable_initial_latent, inpaint_engine,
|
||||
inpaint_strength, inpaint_respective_field
|
||||
|
|
|
|||
Loading…
Reference in New Issue