fix Batches have memory of last position #98

This commit is contained in:
anapnoe
2023-05-01 16:57:45 +03:00
parent 0b27107aeb
commit 9fc075e607
2 changed files with 14 additions and 10 deletions
+9 -5
View File
@@ -362,10 +362,13 @@ function createGallerySpotlight() {
//console.log("clicked");
slide = 0;
gallery = [];
gradioApp().querySelectorAll("#"+selectedTabItemId+' .grid-wrap img').forEach(function (elem, i){
gradioApp().querySelectorAll("#"+selectedTabItemId+' .thumbnails img').forEach(function (elem, i){
elem.setAttribute("gal-id", i);
if(fullImg_src == elem.src) slide = (i+1);
//if(fullImg_src == elem.src) slide = parseInt(i+1);
if(elem.parentElement.className.indexOf("selected") != -1) slide = parseInt(i+1);
//console.log(slide);
gallery[i] = {
src: elem.src,
title: "Seed:" + elem.src,
@@ -407,7 +410,7 @@ function createGallerySpotlight() {
},
onclose: function(index){
gradioApp().querySelector("#"+selectedTabItemId+' .thumbnail-item:nth-child('+(slide+1)+')').click();
gradioApp().querySelector("#"+selectedTabItemId+' .thumbnails .thumbnail-item:nth-child('+(slide+1)+')').click();
}
};
@@ -432,13 +435,14 @@ function onUiHeaderTabUpdate(){
intervalUiUpdateIViewer = setInterval(onUiUpdateIViewer, 500);
}
let fullImg_preview;
function onUiUpdateIViewer(){
clearInterval(intervalUiUpdateIViewer);
//update_performant_inputs(selectedTabItemId);
//fullImg_preview = gradioApp().querySelector('#'+selectedTabItemId+' [id$="2img_results"] .modify-upload + img.w-full.object-contain');
fullImg_preview = gradioApp().querySelector('#'+selectedTabItemId+' .preview img');
fullImg_preview = gradioApp().querySelector('#'+selectedTabItemId+' .preview > img');
if(opts.js_modal_lightbox && fullImg_preview ) {
fullImg_src = fullImg_preview.src;
+5 -5
View File
@@ -1,10 +1,11 @@
// various functions for interaction with ui.py not large enough to warrant putting them in separate files
function set_theme(theme){
gradioURL = window.location.href
/*
gradioURL = window.location.href
if (!gradioURL.includes('?__theme=')) {
window.location.replace(gradioURL + '?__theme=' + theme);
}
}
*/
}
function all_gallery_buttons() {
@@ -200,7 +201,6 @@ function modelmerger(){
return res
}
function ask_for_style_name(_, prompt_text, negative_prompt_text) {
name_ = prompt('Style name:')
return [name_, prompt_text, negative_prompt_text]
@@ -242,7 +242,7 @@ function recalculate_prompts_inpaint(){
return args_to_array(arguments);
}
let selectedTabItemId = "tab_txt2img";
let selectedTabItemId = "tab_txt2img";
opts = {}
onUiUpdate(function(){
if(Object.keys(opts).length != 0) return;