From a243bc7859b7ab92a28d28c11b0ed5525fa0d6ba Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Tue, 6 Sep 2022 02:09:01 +0300 Subject: added progressbar added an option to disable progressbar added interrupt support to DDIM/PLMS --- script.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'script.js') diff --git a/script.js b/script.js index 7aa07e56..ff301e49 100644 --- a/script.js +++ b/script.js @@ -51,6 +51,8 @@ function gradioApp(){ return document.getElementsByTagName('gradio-app')[0].shadowRoot; } +global_progressbar = null + function addTitles(root){ root.querySelectorAll('span, button, select').forEach(function(span){ tooltip = titles[span.textContent]; @@ -71,6 +73,17 @@ function addTitles(root){ select.title = titles[select.value] || ""; } }) + + progressbar = root.getElementById('progressbar') + if(progressbar!= null && progressbar != global_progressbar){ + global_progressbar = progressbar + + var mutationObserver = new MutationObserver(function(m){ + window.setTimeout(requestProgress, 500) + }); + mutationObserver.observe( progressbar, { childList:true, subtree:true }) + } + } document.addEventListener("DOMContentLoaded", function() { @@ -78,7 +91,6 @@ document.addEventListener("DOMContentLoaded", function() { addTitles(gradioApp()); }); mutationObserver.observe( gradioApp(), { childList:true, subtree:true }) - }); function selected_gallery_index(){ @@ -105,3 +117,22 @@ function extract_image_from_gallery(gallery){ return gallery[index]; } + + +function requestProgress(){ + btn = gradioApp().getElementById("check_progress"); + if(btn==null) return; + + btn.click(); +} + +function submit(){ + window.setTimeout(requestProgress, 500) + + res = [] + for(var i=0;i