mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: add config for enhance upv checkbox and method, prefix with default_
This commit is contained in:
@@ -968,10 +968,10 @@ def worker():
|
|||||||
|
|
||||||
if 'vary' in goals:
|
if 'vary' in goals:
|
||||||
img, denoising_strength, initial_latent, width, height, current_progress = apply_vary(
|
img, denoising_strength, initial_latent, width, height, current_progress = apply_vary(
|
||||||
async_task, async_task.enhance_uov_method, denoising_strength, img, switch, current_progress)
|
async_task, async_task.default_enhance_uov_method, denoising_strength, img, switch, current_progress)
|
||||||
if 'upscale' in goals:
|
if 'upscale' in goals:
|
||||||
direct_return, img, denoising_strength, initial_latent, tiled, width, height, current_progress = apply_upscale(
|
direct_return, img, denoising_strength, initial_latent, tiled, width, height, current_progress = apply_upscale(
|
||||||
async_task, img, async_task.enhance_uov_method, switch, current_progress)
|
async_task, img, async_task.default_enhance_uov_method, switch, current_progress)
|
||||||
if direct_return:
|
if direct_return:
|
||||||
d = [('Upscale (Fast)', 'upscale_fast', '2x')]
|
d = [('Upscale (Fast)', 'upscale_fast', '2x')]
|
||||||
if modules.config.default_black_out_nsfw or async_task.black_out_nsfw:
|
if modules.config.default_black_out_nsfw or async_task.black_out_nsfw:
|
||||||
@@ -1031,7 +1031,7 @@ def worker():
|
|||||||
current_progress = int(base_progress + (100 - preparation_steps) / float(all_steps) * (done_steps_upscaling + done_steps_inpainting))
|
current_progress = int(base_progress + (100 - preparation_steps) / float(all_steps) * (done_steps_upscaling + done_steps_inpainting))
|
||||||
goals_enhance = []
|
goals_enhance = []
|
||||||
img, skip_prompt_processing, steps = prepare_upscale(
|
img, skip_prompt_processing, steps = prepare_upscale(
|
||||||
async_task, goals_enhance, img, async_task.enhance_uov_method, async_task.performance_selection,
|
async_task, goals_enhance, img, async_task.default_enhance_uov_method, async_task.performance_selection,
|
||||||
enhance_steps, current_progress)
|
enhance_steps, current_progress)
|
||||||
steps, _, _, _ = apply_overrides(async_task, steps, height, width)
|
steps, _, _, _ = apply_overrides(async_task, steps, height, width)
|
||||||
exception_result = ''
|
exception_result = ''
|
||||||
@@ -1049,7 +1049,7 @@ def worker():
|
|||||||
print('User skipped')
|
print('User skipped')
|
||||||
async_task.last_stop = False
|
async_task.last_stop = False
|
||||||
# also skip all enhance steps for this image, but add the steps to the progress bar
|
# also skip all enhance steps for this image, but add the steps to the progress bar
|
||||||
if async_task.enhance_uov_processing_order == flags.enhancement_uov_before:
|
if async_task.default_enhance_uov_processing_order == flags.enhancement_uov_before:
|
||||||
done_steps_inpainting += len(async_task.enhance_ctrls) * enhance_steps
|
done_steps_inpainting += len(async_task.enhance_ctrls) * enhance_steps
|
||||||
exception_result = 'continue'
|
exception_result = 'continue'
|
||||||
else:
|
else:
|
||||||
|
|||||||
+14
-2
@@ -515,13 +515,25 @@ default_enhance_tabs = get_config_item_or_set_default(
|
|||||||
validator=lambda x: isinstance(x, int) and 1 <= x <= 5,
|
validator=lambda x: isinstance(x, int) and 1 <= x <= 5,
|
||||||
expected_type=int
|
expected_type=int
|
||||||
)
|
)
|
||||||
enhance_uov_processing_order = get_config_item_or_set_default(
|
default_enhance_checkbox = get_config_item_or_set_default(
|
||||||
|
key='default_enhance_checkbox',
|
||||||
|
default_value=False,
|
||||||
|
validator=lambda x: isinstance(x, bool),
|
||||||
|
expected_type=bool
|
||||||
|
)
|
||||||
|
default_enhance_uov_method = get_config_item_or_set_default(
|
||||||
|
key='default_enhance_uov_method',
|
||||||
|
default_value=modules.flags.disabled,
|
||||||
|
validator=lambda x: x in modules.flags.uov_list,
|
||||||
|
expected_type=int
|
||||||
|
)
|
||||||
|
default_enhance_uov_processing_order = get_config_item_or_set_default(
|
||||||
key='default_enhance_uov_processing_order',
|
key='default_enhance_uov_processing_order',
|
||||||
default_value=modules.flags.enhancement_uov_before,
|
default_value=modules.flags.enhancement_uov_before,
|
||||||
validator=lambda x: x in modules.flags.enhancement_uov_processing_order,
|
validator=lambda x: x in modules.flags.enhancement_uov_processing_order,
|
||||||
expected_type=int
|
expected_type=int
|
||||||
)
|
)
|
||||||
enhance_uov_prompt_type = get_config_item_or_set_default(
|
default_enhance_uov_prompt_type = get_config_item_or_set_default(
|
||||||
key='default_enhance_uov_prompt_type',
|
key='default_enhance_uov_prompt_type',
|
||||||
default_value=modules.flags.enhancement_uov_prompt_type_original,
|
default_value=modules.flags.enhancement_uov_prompt_type_original,
|
||||||
validator=lambda x: x in modules.flags.enhancement_uov_prompt_types,
|
validator=lambda x: x in modules.flags.enhancement_uov_prompt_types,
|
||||||
|
|||||||
+1
-3
@@ -8,9 +8,7 @@ upscale_15 = 'Upscale (1.5x)'
|
|||||||
upscale_2 = 'Upscale (2x)'
|
upscale_2 = 'Upscale (2x)'
|
||||||
upscale_fast = 'Upscale (Fast 2x)'
|
upscale_fast = 'Upscale (Fast 2x)'
|
||||||
|
|
||||||
uov_list = [
|
uov_list = [disabled, subtle_variation, strong_variation, upscale_15, upscale_2, upscale_fast]
|
||||||
disabled, subtle_variation, strong_variation, upscale_15, upscale_2, upscale_fast
|
|
||||||
]
|
|
||||||
|
|
||||||
enhancement_uov_before = "Before First Enhancement"
|
enhancement_uov_before = "Before First Enhancement"
|
||||||
enhancement_uov_after = "After Last Enhancement"
|
enhancement_uov_after = "After Last Enhancement"
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ with shared.gradio_root:
|
|||||||
skip_button.click(skip_clicked, inputs=currentTask, outputs=currentTask, queue=False, show_progress=False)
|
skip_button.click(skip_clicked, inputs=currentTask, outputs=currentTask, queue=False, show_progress=False)
|
||||||
with gr.Row(elem_classes='advanced_check_row'):
|
with gr.Row(elem_classes='advanced_check_row'):
|
||||||
input_image_checkbox = gr.Checkbox(label='Input Image', value=False, container=False, elem_classes='min_check')
|
input_image_checkbox = gr.Checkbox(label='Input Image', value=False, container=False, elem_classes='min_check')
|
||||||
enhance_checkbox = gr.Checkbox(label='Enhance', value=False, container=False, elem_classes='min_check')
|
enhance_checkbox = gr.Checkbox(label='Enhance', value=modules.config.default_enhance_checkbox, container=False, elem_classes='min_check')
|
||||||
advanced_checkbox = gr.Checkbox(label='Advanced', value=modules.config.default_advanced_checkbox, container=False, elem_classes='min_check')
|
advanced_checkbox = gr.Checkbox(label='Advanced', value=modules.config.default_advanced_checkbox, container=False, elem_classes='min_check')
|
||||||
with gr.Row(visible=False) as image_input_panel:
|
with gr.Row(visible=False) as image_input_panel:
|
||||||
with gr.Tabs():
|
with gr.Tabs():
|
||||||
@@ -352,21 +352,22 @@ with shared.gradio_root:
|
|||||||
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
||||||
outputs=metadata_json, queue=False, show_progress=True)
|
outputs=metadata_json, queue=False, show_progress=True)
|
||||||
|
|
||||||
with gr.Row(visible=False) as enhance_input_panel:
|
with gr.Row(visible=modules.config.default_enhance_checkbox) as enhance_input_panel:
|
||||||
with gr.Tabs():
|
with gr.Tabs():
|
||||||
with gr.TabItem(label='Upscale or Variation'):
|
with gr.TabItem(label='Upscale or Variation'):
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
enhance_uov_method = gr.Radio(label='Upscale or Variation:', choices=flags.uov_list, value=flags.disabled)
|
enhance_uov_method = gr.Radio(label='Upscale or Variation:', choices=flags.uov_list,
|
||||||
|
value=modules.config.default_enhance_uov_method)
|
||||||
enhance_uov_processing_order = gr.Radio(label='Order of Processing',
|
enhance_uov_processing_order = gr.Radio(label='Order of Processing',
|
||||||
info='Use before for enhancement of small details and after for large areas.',
|
info='Use before for enhancement of small details and after for large areas.',
|
||||||
choices=flags.enhancement_uov_processing_order,
|
choices=flags.enhancement_uov_processing_order,
|
||||||
value=modules.config.enhance_uov_processing_order)
|
value=modules.config.default_enhance_uov_processing_order)
|
||||||
enhance_uov_prompt_type = gr.Radio(label='Prompt',
|
enhance_uov_prompt_type = gr.Radio(label='Prompt',
|
||||||
info='Choose which prompt to use for Upscale or Variation.',
|
info='Choose which prompt to use for Upscale or Variation.',
|
||||||
choices=flags.enhancement_uov_prompt_types,
|
choices=flags.enhancement_uov_prompt_types,
|
||||||
value=modules.config.enhance_uov_prompt_type,
|
value=modules.config.default_enhance_uov_prompt_type,
|
||||||
visible=modules.config.enhance_uov_prompt_type == flags.enhancement_uov_after)
|
visible=modules.config.default_enhance_uov_processing_order == flags.enhancement_uov_after)
|
||||||
|
|
||||||
enhance_uov_processing_order.change(lambda x: gr.update(visible=x == flags.enhancement_uov_after),
|
enhance_uov_processing_order.change(lambda x: gr.update(visible=x == flags.enhancement_uov_after),
|
||||||
inputs=enhance_uov_processing_order,
|
inputs=enhance_uov_processing_order,
|
||||||
|
|||||||
Reference in New Issue
Block a user