aboutsummaryrefslogtreecommitdiffstats
path: root/javascript
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-23 19:49:21 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-09-23 19:49:21 +0000
commit39ce23f42d9b63eff39c50a0d069a442e6416cf5 (patch)
treebf245801f544389aece3319b381232a697203e42 /javascript
parent9c92a1a9aa8f4c54f6e05a655883143fec917f67 (diff)
downloadstable-diffusion-webui-gfx803-39ce23f42d9b63eff39c50a0d069a442e6416cf5.tar.gz
stable-diffusion-webui-gfx803-39ce23f42d9b63eff39c50a0d069a442e6416cf5.tar.bz2
stable-diffusion-webui-gfx803-39ce23f42d9b63eff39c50a0d069a442e6416cf5.zip
add the bitton to paste parameters into UI for txt2img, img2img, and pnginfo tabs
fixed some [send to..] buttons to work properly with all tabs
Diffstat (limited to 'javascript')
-rw-r--r--javascript/hints.js4
-rw-r--r--javascript/ui.js48
2 files changed, 48 insertions, 4 deletions
diff --git a/javascript/hints.js b/javascript/hints.js
index 9d3eecf3..f1ff645f 100644
--- a/javascript/hints.js
+++ b/javascript/hints.js
@@ -13,6 +13,8 @@ titles = {
"Seed": "A value that determines the output of random number generator - if you create an image with same parameters and seed as another image, you'll get the same result",
"\u{1f3b2}\ufe0f": "Set seed to -1, which will cause a new random number to be used every time",
"\u267b\ufe0f": "Reuse seed from last generation, mostly useful if it was randomed",
+ "\u{1f3a8}": "Add a random artist to the prompt.",
+ "\u2199\ufe0f": "Read generation parameters from prompt into user interface.",
"Inpaint a part of image": "Draw a mask over an image, and the script will regenerate the masked area with content according to prompt",
"SD upscale": "Upscale image normally, split result into tiles, improve each tile using img2img, merge whole image back",
@@ -48,8 +50,6 @@ titles = {
"Tiling": "Produce an image that can be tiled.",
"Tile overlap": "For SD upscale, how much overlap in pixels should there be between tiles. Tiles overlap so that when they are merged back into one picture, there is no clearly visible seam.",
- "Roll": "Add a random artist to the prompt.",
-
"Variation seed": "Seed of a different picture to be mixed into the generation.",
"Variation strength": "How strong of a variation to produce. At 0, there will be no effect. At 1, you will get the complete picture with variation seed (except for ancestral samplers, where you will just get something).",
"Resize seed from height": "Make an attempt to produce a picture similar to what would have been produced with same seed at specified resolution",
diff --git a/javascript/ui.js b/javascript/ui.js
index 22ef5508..076e9436 100644
--- a/javascript/ui.js
+++ b/javascript/ui.js
@@ -25,13 +25,57 @@ function extract_image_from_gallery(gallery){
return gallery[index];
}
-function extract_image_from_gallery_img2img(gallery){
+function args_to_array(args){
+ res = []
+ for(var i=0;i<args.length;i++){
+ res.push(args[i])
+ }
+ return res
+}
+
+function switch_to_txt2img(){
+ gradioApp().querySelectorAll('button')[0].click();
+
+ return args_to_array(arguments);
+}
+
+function switch_to_img2img_img2img(){
+ gradioApp().querySelectorAll('button')[1].click();
+ gradioApp().getElementById('mode_img2img').querySelectorAll('button')[0].click();
+
+ return args_to_array(arguments);
+}
+
+function switch_to_img2img_inpaint(){
gradioApp().querySelectorAll('button')[1].click();
+ gradioApp().getElementById('mode_img2img').querySelectorAll('button')[1].click();
+
+ return args_to_array(arguments);
+}
+
+function switch_to_extras(){
+ gradioApp().querySelectorAll('button')[2].click();
+
+ return args_to_array(arguments);
+}
+
+function extract_image_from_gallery_txt2img(gallery){
+ switch_to_txt2img()
+ return extract_image_from_gallery(gallery);
+}
+
+function extract_image_from_gallery_img2img(gallery){
+ switch_to_img2img_img2img()
+ return extract_image_from_gallery(gallery);
+}
+
+function extract_image_from_gallery_inpaint(gallery){
+ switch_to_img2img_inpaint()
return extract_image_from_gallery(gallery);
}
function extract_image_from_gallery_extras(gallery){
- gradioApp().querySelectorAll('button')[2].click();
+ switch_to_extras()
return extract_image_from_gallery(gallery);
}