diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-02 20:25:29 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-02 20:25:29 +0000 |
commit | 4cafad66d202433bc358d9c4b8291d593b6e4df8 (patch) | |
tree | fe5c7ef5320bc7b7ae8957b1a15835660aebe270 /webui.py | |
parent | b541c8ba3efacd39e08b6d5971bdd45a9e09514e (diff) | |
download | stable-diffusion-webui-gfx803-4cafad66d202433bc358d9c4b8291d593b6e4df8.tar.gz stable-diffusion-webui-gfx803-4cafad66d202433bc358d9c4b8291d593b6e4df8.tar.bz2 stable-diffusion-webui-gfx803-4cafad66d202433bc358d9c4b8291d593b6e4df8.zip |
this should send the currently selected image to other tabs instead of the first
Diffstat (limited to 'webui.py')
-rw-r--r-- | webui.py | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -1288,7 +1288,14 @@ def txt2img(prompt: str, negative_prompt: str, steps: int, sampler_index: int, u return processed.images, processed.js(), plaintext_to_html(processed.info)
+
def image_from_url_text(filedata):
+ if type(filedata) == list:
+ if len(filedata) == 0:
+ return None
+
+ filedata = filedata[0]
+
if filedata.startswith("data:image/png;base64,"):
filedata = filedata[len("data:image/png;base64,"):]
@@ -1368,7 +1375,7 @@ with gr.Blocks(analytics_enabled=False) as txt2img_interface: with gr.Column(variant='panel'):
with gr.Group():
- txt2img_gallery = gr.Gallery(label='Output')
+ txt2img_gallery = gr.Gallery(label='Output', elem_id='txt2img_gallery')
with gr.Group():
with gr.Row():
@@ -1760,7 +1767,7 @@ with gr.Blocks(analytics_enabled=False) as img2img_interface: with gr.Column(variant='panel'):
with gr.Group():
- img2img_gallery = gr.Gallery(label='Output')
+ img2img_gallery = gr.Gallery(label='Output', elem_id='img2img_gallery')
with gr.Group():
with gr.Row():
@@ -1863,13 +1870,15 @@ with gr.Blocks(analytics_enabled=False) as img2img_interface: )
send_to_img2img.click(
- fn=send_gradio_gallery_to_image,
+ fn=lambda x: image_from_url_text(x),
+ _js="extract_image_from_gallery",
inputs=[txt2img_gallery],
outputs=[init_img],
)
send_to_inpaint.click(
- fn=send_gradio_gallery_to_image,
+ fn=lambda x: image_from_url_text(x),
+ _js="extract_image_from_gallery",
inputs=[txt2img_gallery],
outputs=[init_img_with_mask],
)
@@ -1952,14 +1961,17 @@ with gr.Blocks(analytics_enabled=False) as extras_interface: submit.click(**extras_args)
+
send_to_extras.click(
- fn=send_gradio_gallery_to_image,
+ fn=lambda x: image_from_url_text(x),
+ _js="extract_image_from_gallery",
inputs=[txt2img_gallery],
outputs=[image],
)
img2img_send_to_extras.click(
- fn=send_gradio_gallery_to_image,
+ fn=lambda x: image_from_url_text(x),
+ _js="extract_image_from_gallery",
inputs=[img2img_gallery],
outputs=[image],
)
|