root commited on
Commit
810b41f
1 Parent(s): 78393a2

add moveImageFromGallery

Browse files
Files changed (1) hide show
  1. app.py +17 -14
app.py CHANGED
@@ -245,6 +245,7 @@ if __name__ == "__main__":
245
  gallery = gr.Gallery(
246
  label="Generated images", show_label=False, elem_id="gallery"
247
  ).style(grid=[2], height="auto")
 
248
 
249
  gr.Examples(examples=examples, fn=request_images, inputs=text, outputs=gallery, examples_per_page=100)
250
  text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size], outputs=gallery)
@@ -397,21 +398,23 @@ if __name__ == "__main__":
397
  [img2img_image_editor, img2img_image_mask, img2img_btn_editor, img2img_btn_mask,
398
  img2img_painterro_btn, img2img_mask, img2img_mask_blur_strength]
399
  )
 
 
 
 
 
 
 
400
 
401
- # img2img_image_editor_mode.change(
402
- # uifn.update_image_mask,
403
- # [img2img_image_editor, img2img_resize, img2img_width, img2img_height],
404
- # img2img_image_mask
405
- # )
406
-
407
- # output_txt2img_copy_to_input_btn.click(
408
- # uifn.copy_img_to_input,
409
- # [output_txt2img_gallery],
410
- # [img2img_image_editor, img2img_image_mask, tabs],
411
- # _js=call_JS("moveImageFromGallery",
412
- # fromId="txt2img_gallery_output",
413
- # toId="img2img_editor")
414
- # )
415
 
416
  output_img2img_copy_to_input_btn.click(
417
  uifn.copy_img_to_edit,
 
245
  gallery = gr.Gallery(
246
  label="Generated images", show_label=False, elem_id="gallery"
247
  ).style(grid=[2], height="auto")
248
+ output_txt2img_copy_to_input_btn = gr.Button("Go to img2img")
249
 
250
  gr.Examples(examples=examples, fn=request_images, inputs=text, outputs=gallery, examples_per_page=100)
251
  text.submit(request_images, inputs=[text, class_draw, style_draw, sample_size], outputs=gallery)
 
398
  [img2img_image_editor, img2img_image_mask, img2img_btn_editor, img2img_btn_mask,
399
  img2img_painterro_btn, img2img_mask, img2img_mask_blur_strength]
400
  )
401
+
402
+ # 这个函数之前注释掉了,但是没有出现bug,看一下这个的作用;
403
+ img2img_image_editor_mode.change(
404
+ uifn.update_image_mask,
405
+ [img2img_image_editor, img2img_resize, img2img_width, img2img_height],
406
+ img2img_image_mask
407
+ )
408
 
409
+ #
410
+ output_txt2img_copy_to_input_btn.click(
411
+ uifn.copy_img_to_input,
412
+ [gallery],
413
+ [img2img_image_editor, img2img_image_mask, tabs],
414
+ _js=call_JS("moveImageFromGallery",
415
+ fromId="txt2img_gallery_output",
416
+ toId="img2img_editor")
417
+ )
 
 
 
 
 
418
 
419
  output_img2img_copy_to_input_btn.click(
420
  uifn.copy_img_to_edit,