Commit aa1d1bf4 authored by innovaciones's avatar innovaciones Committed by AUTOMATIC1111

New position and interrupt integration

parent c9ee9844
...@@ -350,11 +350,14 @@ def create_toprow(is_img2img): ...@@ -350,11 +350,14 @@ def create_toprow(is_img2img):
with gr.Column(scale=1): with gr.Column(scale=1):
with gr.Row(): with gr.Row():
progressbar = gr.HTML(elem_id="progressbar") interrupt = gr.Button('Interrupt', elem_id="interrupt")
submit = gr.Button('Generate', elem_id="generate", variant='primary') submit = gr.Button('Generate', elem_id="generate", variant='primary')
txt2img_preview = gr.Image(elem_id='txt2img_preview', visible=False) interrupt.click(
setup_progressbar(progressbar, txt2img_preview) fn=lambda: shared.state.interrupt(),
inputs=[],
outputs=[],
)
with gr.Row(): with gr.Row():
if is_img2img: if is_img2img:
...@@ -390,6 +393,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): ...@@ -390,6 +393,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
txt2img_prompt, roll, txt2img_prompt_style, txt2img_negative_prompt, txt2img_prompt_style2, submit, _, txt2img_prompt_style_apply, txt2img_save_style = create_toprow(is_img2img=False) txt2img_prompt, roll, txt2img_prompt_style, txt2img_negative_prompt, txt2img_prompt_style2, submit, _, txt2img_prompt_style_apply, txt2img_save_style = create_toprow(is_img2img=False)
dummy_component = gr.Label(visible=False) dummy_component = gr.Label(visible=False)
with gr.Row(elem_id='progressRow'):
with gr.Column(scale=1):
columnEmpty = "Empty"
with gr.Column(scale=1):
progressbar = gr.HTML(elem_id="progressbar")
txt2img_preview = gr.Image(elem_id='txt2img_preview', visible=False)
setup_progressbar(progressbar, txt2img_preview)
with gr.Row().style(equal_height=False): with gr.Row().style(equal_height=False):
with gr.Column(variant='panel'): with gr.Column(variant='panel'):
steps = gr.Slider(minimum=1, maximum=150, step=1, label="Sampling Steps", value=20) steps = gr.Slider(minimum=1, maximum=150, step=1, label="Sampling Steps", value=20)
...@@ -431,7 +443,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): ...@@ -431,7 +443,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
send_to_img2img = gr.Button('Send to img2img') send_to_img2img = gr.Button('Send to img2img')
send_to_inpaint = gr.Button('Send to inpaint') send_to_inpaint = gr.Button('Send to inpaint')
send_to_extras = gr.Button('Send to extras') send_to_extras = gr.Button('Send to extras')
interrupt = gr.Button('Interrupt')
with gr.Group(): with gr.Group():
html_info = gr.HTML() html_info = gr.HTML()
...@@ -480,12 +491,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): ...@@ -480,12 +491,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
outputs=[hr_options], outputs=[hr_options],
) )
interrupt.click(
fn=lambda: shared.state.interrupt(),
inputs=[],
outputs=[],
)
save.click( save.click(
fn=wrap_gradio_call(save_files), fn=wrap_gradio_call(save_files),
_js="(x, y, z) => [x, y, selected_gallery_index()]", _js="(x, y, z) => [x, y, selected_gallery_index()]",
...@@ -514,6 +519,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): ...@@ -514,6 +519,15 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
with gr.Blocks(analytics_enabled=False) as img2img_interface: with gr.Blocks(analytics_enabled=False) as img2img_interface:
img2img_prompt, roll, img2img_prompt_style, img2img_negative_prompt, img2img_prompt_style2, submit, img2img_interrogate, img2img_prompt_style_apply, img2img_save_style = create_toprow(is_img2img=True) img2img_prompt, roll, img2img_prompt_style, img2img_negative_prompt, img2img_prompt_style2, submit, img2img_interrogate, img2img_prompt_style_apply, img2img_save_style = create_toprow(is_img2img=True)
with gr.Row(elem_id='progressRow'):
with gr.Column(scale=1):
columnEmpty = "Empty"
with gr.Column(scale=1):
progressbar = gr.HTML(elem_id="progressbar")
img2img_preview = gr.Image(elem_id='img2img_preview', visible=False)
setup_progressbar(progressbar, img2img_preview)
with gr.Row().style(equal_height=False): with gr.Row().style(equal_height=False):
with gr.Column(variant='panel'): with gr.Column(variant='panel'):
with gr.Group(): with gr.Group():
...@@ -562,21 +576,17 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): ...@@ -562,21 +576,17 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
custom_inputs = modules.scripts.scripts_img2img.setup_ui(is_img2img=True) custom_inputs = modules.scripts.scripts_img2img.setup_ui(is_img2img=True)
with gr.Column(variant='panel'): with gr.Column(variant='panel'):
progressbar = gr.HTML(elem_id="progressbar")
with gr.Group(): with gr.Group():
img2img_preview = gr.Image(elem_id='img2img_preview', visible=False) img2img_preview = gr.Image(elem_id='img2img_preview', visible=False)
img2img_gallery = gr.Gallery(label='Output', elem_id='img2img_gallery').style(grid=4) img2img_gallery = gr.Gallery(label='Output', elem_id='img2img_gallery').style(grid=4)
setup_progressbar(progressbar, img2img_preview)
with gr.Group(): with gr.Group():
with gr.Row(): with gr.Row():
save = gr.Button('Save') save = gr.Button('Save')
img2img_send_to_img2img = gr.Button('Send to img2img') img2img_send_to_img2img = gr.Button('Send to img2img')
img2img_send_to_inpaint = gr.Button('Send to inpaint') img2img_send_to_inpaint = gr.Button('Send to inpaint')
img2img_send_to_extras = gr.Button('Send to extras') img2img_send_to_extras = gr.Button('Send to extras')
interrupt = gr.Button('Interrupt')
img2img_save_style = gr.Button('Save prompt as style') img2img_save_style = gr.Button('Save prompt as style')
...@@ -690,12 +700,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): ...@@ -690,12 +700,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
outputs=[img2img_prompt], outputs=[img2img_prompt],
) )
interrupt.click(
fn=lambda: shared.state.interrupt(),
inputs=[],
outputs=[],
)
save.click( save.click(
fn=wrap_gradio_call(save_files), fn=wrap_gradio_call(save_files),
_js="(x, y, z) => [x, y, selected_gallery_index()]", _js="(x, y, z) => [x, y, selected_gallery_index()]",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment