aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/ui.js
diff options
context:
space:
mode:
authorspace-nuko <24979496+space-nuko@users.noreply.github.com>2023-03-25 16:52:14 +0000
committerspace-nuko <24979496+space-nuko@users.noreply.github.com>2023-03-25 16:52:35 +0000
commit68999d0b15d612965e7bc7feb62d6b4d55e112fa (patch)
treeaa99b49045ff10b7b4b6524decbdb4b323b384cf /javascript/ui.js
parent91ae48fd7e20c60d6374f340cac0939f56d87048 (diff)
downloadstable-diffusion-webui-gfx803-68999d0b15d612965e7bc7feb62d6b4d55e112fa.tar.gz
stable-diffusion-webui-gfx803-68999d0b15d612965e7bc7feb62d6b4d55e112fa.tar.bz2
stable-diffusion-webui-gfx803-68999d0b15d612965e7bc7feb62d6b4d55e112fa.zip
Add upscale slider to img2img
Diffstat (limited to 'javascript/ui.js')
-rw-r--r--javascript/ui.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/javascript/ui.js b/javascript/ui.js
index fcaf5608..8aa4a459 100644
--- a/javascript/ui.js
+++ b/javascript/ui.js
@@ -8,8 +8,8 @@ function set_theme(theme){
}
function selected_gallery_index(){
- var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem div[id$=_gallery] .gallery-item')
- var button = gradioApp().querySelector('[style="display: block;"].tabitem div[id$=_gallery] .gallery-item.\\!ring-2')
+ var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem div[id$=_gallery] .thumbnails > .thumbnail-item')
+ var button = gradioApp().querySelector('[style="display: block;"].tabitem div[id$=_gallery] .thumbnails > .thumbnail-item.selected')
var result = -1
buttons.forEach(function(v, i){ if(v==button) { result = i } })
@@ -111,6 +111,14 @@ function get_img2img_tab_index() {
return res
}
+function get_img2img_tab_index_for_res_preview() {
+ let res = args_to_array(arguments)
+ res.splice(-1) // gradio also sends outputs to the arguments, pop them off
+ res[0] = get_tab_index('mode_img2img')
+ debugger;
+ return res
+}
+
function create_submit_args(args){
res = []
for(var i=0;i<args.length;i++){
@@ -335,3 +343,16 @@ function selectCheckpoint(name){
desiredCheckpointName = name;
gradioApp().getElementById('change_checkpoint').click()
}
+
+
+function onCalcResolutionImg2Img(init_img, scale, width, height, resize_mode){
+ i2iScale = gradioApp().getElementById('img2img_scale')
+ i2iWidth = gradioApp().getElementById('img2img_width')
+ i2iHeight = gradioApp().getElementById('img2img_height')
+
+ setInactive(i2iScale, scale == 1)
+ setInactive(i2iWidth, scale > 1)
+ setInactive(i2iHeight, scale > 1)
+
+ return [init_img, width, height, scale, resize_mode]
+}