From 34ef7bc881cfcb7bf4cc080d6958df2852b37859 Mon Sep 17 00:00:00 2001 From: Haoming Date: Thu, 31 Jul 2025 15:03:30 +0800 Subject: [PATCH] extras --- modules/ui_postprocessing.py | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/modules/ui_postprocessing.py b/modules/ui_postprocessing.py index 6c6cf5e3..7d179d89 100644 --- a/modules/ui_postprocessing.py +++ b/modules/ui_postprocessing.py @@ -9,19 +9,19 @@ def create_ui(): dummy_component = gr.Textbox(visible=False) tab_index = gr.State(value=0) - with ResizeHandleRow(equal_height=False, variant='compact'): - with gr.Column(variant='compact'): + with ResizeHandleRow(equal_height=False, variant="compact"): + with gr.Column(variant="compact"): with gr.Tabs(elem_id="mode_extras"): - with gr.TabItem('Single Image', id="single_image", elem_id="extras_single_tab") as tab_single: - extras_image = gr.Image(label="Source", interactive=True, type="pil", elem_id="extras_image", image_mode="RGBA", height="55vh") + with gr.TabItem("Single Image", id="single_image", elem_id="extras_single_tab") as tab_single: + extras_image = gr.Image(label="Source", interactive=True, type="pil", elem_id="extras_image", image_mode="RGBA", height="48vh", sources="upload", show_download_button=False, show_share_button=False) - with gr.TabItem('Batch Process', id="batch_process", elem_id="extras_batch_process_tab") as tab_batch: + with gr.TabItem("Batch Process", id="batch_process", elem_id="extras_batch_process_tab") as tab_batch: image_batch = gr.Files(label="Batch Process", interactive=True, elem_id="extras_image_batch") - with gr.TabItem('Batch from Directory', id="batch_from_directory", elem_id="extras_batch_directory_tab") as tab_batch_dir: + with gr.TabItem("Batch from Directory", id="batch_from_directory", elem_id="extras_batch_directory_tab") as tab_batch_dir: extras_batch_input_dir = gr.Textbox(label="Input directory", **shared.hide_dirs, placeholder="A directory on the same machine where the server is running.", elem_id="extras_batch_input_dir") extras_batch_output_dir = gr.Textbox(label="Output directory", **shared.hide_dirs, placeholder="Leave blank to save images to the default path.", elem_id="extras_batch_output_dir") - show_extras_results = gr.Checkbox(label='Show result images', value=True, elem_id="extras_show_extras_results") + show_extras_results = gr.Checkbox(label="Show result images", value=True, elem_id="extras_show_extras_results") script_inputs = scripts.scripts_postproc.setup_ui() @@ -36,19 +36,10 @@ def create_ui(): tab_batch.select(fn=lambda: 1, inputs=[], outputs=[tab_index]) tab_batch_dir.select(fn=lambda: 2, inputs=[], outputs=[tab_index]) - submit_click_inputs = [ - dummy_component, - tab_index, - extras_image, - image_batch, - extras_batch_input_dir, - extras_batch_output_dir, - show_extras_results, - *script_inputs - ] + submit_click_inputs = [dummy_component, tab_index, extras_image, image_batch, extras_batch_input_dir, extras_batch_output_dir, show_extras_results, *script_inputs] submit.click( - fn=call_queue.wrap_gradio_gpu_call(postprocessing.run_postprocessing_webui, extra_outputs=[None, '']), + fn=call_queue.wrap_gradio_gpu_call(postprocessing.run_postprocessing_webui, extra_outputs=[None, ""]), _js=f"submit_extras", inputs=submit_click_inputs, outputs=[ @@ -61,7 +52,4 @@ def create_ui(): parameters_copypaste.add_paste_fields("extras", extras_image, None) - extras_image.change( - fn=scripts.scripts_postproc.image_changed, - inputs=[], outputs=[] - ) + extras_image.change(fn=scripts.scripts_postproc.image_changed, inputs=[], outputs=[])