mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-02-09 01:19:58 +00:00
Gradio 4 + WebUI 1.10
This commit is contained in:
@@ -2,17 +2,18 @@ import gradio as gr
|
||||
from modules import scripts, shared, ui_common, postprocessing, call_queue, ui_toprow
|
||||
import modules.infotext_utils as parameters_copypaste
|
||||
from modules.ui_components import ResizeHandleRow
|
||||
from modules_forge.forge_canvas.canvas import ForgeCanvas
|
||||
|
||||
|
||||
def create_ui():
|
||||
dummy_component = gr.Label(visible=False)
|
||||
tab_index = gr.Number(value=0, visible=False)
|
||||
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 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", source="upload", interactive=True, type="pil", elem_id="extras_image")
|
||||
extras_image = ForgeCanvas(elem_id="extras_image", height=512, no_scribbles=True).background
|
||||
|
||||
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")
|
||||
@@ -35,19 +36,21 @@ 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(
|
||||
fn=call_queue.wrap_gradio_gpu_call(postprocessing.run_postprocessing_webui, extra_outputs=[None, '']),
|
||||
_js="submit_extras",
|
||||
inputs=[
|
||||
dummy_component,
|
||||
tab_index,
|
||||
extras_image,
|
||||
image_batch,
|
||||
extras_batch_input_dir,
|
||||
extras_batch_output_dir,
|
||||
show_extras_results,
|
||||
*script_inputs
|
||||
],
|
||||
js=f"(...args) => {{ return submit_extras(args.slice(0, {len(submit_click_inputs)})); }}",
|
||||
inputs=submit_click_inputs,
|
||||
outputs=[
|
||||
output_panel.gallery,
|
||||
output_panel.generation_info,
|
||||
|
||||
Reference in New Issue
Block a user