Skip to content

Commit

Permalink
Merge pull request #21 from P2Enjoy/martinobettucci-patch-1
Browse files Browse the repository at this point in the history
Martinobettucci patch 1
  • Loading branch information
d8ahazard authored Jan 22, 2023
2 parents 330f47f + 5c1def0 commit 41fb35e
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions javascript/smart_process.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
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';

function start_smart_process() {
requestProgress('sp');
gradioApp().querySelector('#sp_error').innerHTML = '';
return args_to_array(arguments);
rememberGallerySelection(SP_GALLERY_LABEL)
gradioApp().querySelector('#sp_error').innerHTML = ''
var spGalleryElt = gradioApp().getElementById(SP_GALLERY_LABEL)
// set id of first child of spGalleryElt to 'sp_gallery_kid',
// required by AUTOMATIC1111 UI Logic
spGalleryElt.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
}

onUiUpdate(function () {
check_progressbar('sp', 'sp_progressbar', 'sp_progress_span', '', 'sp_interrupt', 'sp_preview', 'sp_gallery')
})
onUiUpdate(function(){
check_gallery(SP_GALLERY_LABEL)
})

0 comments on commit 41fb35e

Please sign in to comment.