Add upscale slider to img2img

This commit is contained in:
space-nuko
2023-03-25 12:52:14 -04:00
parent 91ae48fd7e
commit 68999d0b15
6 changed files with 644 additions and 286 deletions

View File

@@ -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]
}