mirror of
https://github.com/anapnoe/stable-diffusion-webui-ux.git
synced 2026-09-19 01:05:13 +02:00
Merge branch 'dev' of https://github.com/anapnoe/stable-diffusion-webui-ux into dev
This commit is contained in:
+47
-26
@@ -159,13 +159,24 @@ function showSubmitButtons(tabname, show){
|
||||
gradioApp().getElementById(tabname+'_skip').style.display = show ? "none" : "block"
|
||||
}
|
||||
|
||||
function showRestoreProgressButton(tabname, show){
|
||||
button = gradioApp().getElementById(tabname + "_restore_progress")
|
||||
if(! button) return
|
||||
|
||||
button.style.display = show ? "flex" : "none"
|
||||
}
|
||||
|
||||
function submit(){
|
||||
rememberGallerySelection('txt2img_gallery')
|
||||
showSubmitButtons('txt2img', false)
|
||||
|
||||
var id = randomId()
|
||||
localStorage.setItem("txt2img_task_id", id);
|
||||
|
||||
requestProgress(id, gradioApp().getElementById('txt2img_gallery_container'), gradioApp().getElementById('txt2img_gallery'), function(){
|
||||
showSubmitButtons('txt2img', true)
|
||||
localStorage.removeItem("txt2img_task_id")
|
||||
showRestoreProgressButton('txt2img', false)
|
||||
})
|
||||
|
||||
var res = create_submit_args(arguments)
|
||||
@@ -180,8 +191,12 @@ function submit_img2img(){
|
||||
showSubmitButtons('img2img', false)
|
||||
|
||||
var id = randomId()
|
||||
localStorage.setItem("img2img_task_id", id);
|
||||
|
||||
requestProgress(id, gradioApp().getElementById('img2img_gallery_container'), gradioApp().getElementById('img2img_gallery'), function(){
|
||||
showSubmitButtons('img2img', true)
|
||||
localStorage.removeItem("img2img_task_id")
|
||||
showRestoreProgressButton('img2img', false)
|
||||
})
|
||||
|
||||
var res = create_submit_args(arguments)
|
||||
@@ -192,6 +207,36 @@ function submit_img2img(){
|
||||
return res
|
||||
}
|
||||
|
||||
function restoreProgressTxt2img(x){
|
||||
id = localStorage.getItem("txt2img_task_id")
|
||||
|
||||
if(id) {
|
||||
requestProgress(id, gradioApp().getElementById('txt2img_gallery_container'), gradioApp().getElementById('txt2img_gallery'), function(){
|
||||
showSubmitButtons('txt2img', true)
|
||||
}, null, 0)
|
||||
}
|
||||
|
||||
return [id]
|
||||
}
|
||||
function restoreProgressImg2img(x){
|
||||
id = localStorage.getItem("img2img_task_id")
|
||||
|
||||
if(id) {
|
||||
requestProgress(id, gradioApp().getElementById('img2img_gallery_container'), gradioApp().getElementById('img2img_gallery'), function(){
|
||||
showSubmitButtons('img2img', true)
|
||||
}, null, 0)
|
||||
}
|
||||
|
||||
return [id]
|
||||
}
|
||||
|
||||
|
||||
onUiLoaded(function () {
|
||||
showRestoreProgressButton('txt2img', localStorage.getItem("txt2img_task_id"))
|
||||
showRestoreProgressButton('img2img', localStorage.getItem("img2img_task_id"))
|
||||
});
|
||||
|
||||
|
||||
function modelmerger(){
|
||||
var id = randomId()
|
||||
requestProgress(id, gradioApp().getElementById('modelmerger_results_panel'), null, function(){})
|
||||
@@ -1546,32 +1591,6 @@ function selectCheckpoint(name){
|
||||
gradioApp().getElementById('change_checkpoint').click()
|
||||
}
|
||||
|
||||
function restoreProgress (task_tag) {
|
||||
|
||||
if (task_tag) {
|
||||
let successHandler = ({ current_task }) => {
|
||||
if (current_task) {
|
||||
showSubmitButtons(task_tag, false)
|
||||
requestProgress(current_task, gradioApp().getElementById(`${task_tag}_gallery_container`), gradioApp().getElementById(`${task_tag}_gallery`), function(){
|
||||
showSubmitButtons(task_tag, true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let errorHandler = e => window.alert(`invalid internal api respsonse. message: ${e}`)
|
||||
|
||||
fetch("./internal/current_task")
|
||||
.then(res => res.json())
|
||||
.then(successHandler)
|
||||
.catch(errorHandler)
|
||||
}
|
||||
|
||||
var res = create_submit_args(arguments)
|
||||
res[0] = 0
|
||||
return res
|
||||
|
||||
}
|
||||
|
||||
function currentImg2imgSourceResolution(_, _, scaleBy){
|
||||
var img = gradioApp().querySelector('#mode_img2img > div[style="display: block;"] img')
|
||||
return img ? [img.naturalWidth, img.naturalHeight, scaleBy] : [0, 0, scaleBy]
|
||||
@@ -1603,3 +1622,5 @@ window.onload = function() {
|
||||
setTimeout(function(){document.body.style.display = "block";},1000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user