Update smart_process.js

Signed-off-by: Martino Bettucci <martinobettucci@users.noreply.github.com>
pull/21/head
Martino Bettucci 2023-01-19 13:42:26 +01:00 committed by GitHub
parent 330f47f859
commit 231cda38df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 8 deletions

View File

@ -1,9 +1,28 @@
function start_smart_process() {
requestProgress('sp');
gradioApp().querySelector('#sp_error').innerHTML = '';
return args_to_array(arguments);
}
const SP_PROGRESSBAR_LABEL = 'sp_preview'
const SP_GALLERY_LABEL = 'sp_gallery'
const SP_ERROR_LABEL = '#sp_error'
const SP_GALLERY_CHILD = 'sp_gallery_kid';
const SP_PROGRESS_LABEL = 'sp_progress';
onUiUpdate(function () {
check_progressbar('sp', 'sp_progressbar', 'sp_progress_span', '', 'sp_interrupt', 'sp_preview', 'sp_gallery')
})
function start_smart_process() {
rememberGallerySelection(SP_GALLERY_LABEL)
gradioApp().querySelector('#sp_error').innerHTML = ''
var daGalleryElt = gradioApp().getElementById(SP_GALLERY_LABEL)
// set id of first child of daGalleryElt to 'sp_gallery_kid',
// required by AUTOMATIC1111 UI Logic
daGalleryElt.children[0].id = SP_GALLERY_CHILD
var id = randomId();
requestProgress(id,
gradioApp().getElementById(SP_GALLERY_LABEL),
gradioApp().getElementById(SP_GALLERY_CHILD),
function () {
},
function (progress) {
gradioApp().getElementById(SP_PROGRESS_LABEL).innerHTML = progress.textinfo
})
const argsToArray = args_to_array(arguments);
argsToArray.push(argsToArray[0])
argsToArray[0] = id;
return argsToArray
}