add preset selection

uses meta parsing to set presets in user session (UI elements only)
This commit is contained in:
Manuel Schmid
2023-12-23 19:30:49 +01:00
parent 7b5bced6c2
commit f56e3eb3b0
3 changed files with 109 additions and 32 deletions
+35
View File
@@ -220,6 +220,10 @@ with shared.gradio_root:
with gr.Column(scale=1, visible=modules.config.default_advanced_checkbox) as advanced_column:
with gr.Tab(label='Setting'):
preset_selection = gr.Radio(label='Preset',
choices=modules.config.available_presets,
value=args_manager.args.preset if args_manager.args.preset else "None",
interactive=True)
performance_selection = gr.Radio(label='Performance',
choices=modules.flags.performance_selections,
value=modules.config.default_performance)
@@ -456,6 +460,37 @@ with shared.gradio_root:
model_refresh.click(model_refresh_clicked, [], [base_model, refiner_model] + lora_ctrls,
queue=False, show_progress=False)
def preset_selection_change(preset):
preset_content = modules.config.try_get_preset_content(preset)
if preset_content is not None:
return modules.meta_parser.parse_meta_from_preset(preset_content)
preset_selection.change(preset_selection_change, inputs=preset_selection, outputs=[
advanced_checkbox,
image_number,
prompt,
negative_prompt,
style_selections,
performance_selection,
aspect_ratios_selection,
overwrite_width,
overwrite_height,
sharpness,
guidance_scale,
adm_scaler_positive,
adm_scaler_negative,
adm_scaler_end,
base_model,
refiner_model,
refiner_switch,
sampler_name,
scheduler_name,
seed_random,
image_seed,
generate_button,
load_parameter_button
] + lora_ctrls, queue=False, show_progress=False)
performance_selection.change(lambda x: [gr.update(interactive=x != 'Extreme Speed')] * 11 +
[gr.update(visible=x != 'Extreme Speed')] * 1,
inputs=performance_selection,