Unverified Commit 243253ff authored by random-thoughtss's avatar random-thoughtss Committed by GitHub
Browse files

Merge branch 'AUTOMATIC1111:master' into master

parents d9e4e4d7 20a860b5
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line

function extensions_apply(_, _){
    disable = []
    update = []
    gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){
        if(x.name.startsWith("enable_") && ! x.checked)
            disable.push(x.name.substr(7))

        if(x.name.startsWith("update_") && x.checked)
            update.push(x.name.substr(7))
    })

    restart_reload()

    return [JSON.stringify(disable), JSON.stringify(update)]
}

function extensions_check(){
    gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){
        x.innerHTML = "Loading..."
    })

    return []
}

function install_extension_from_index(button, url){
    button.disabled = "disabled"
    button.value = "Installing..."

    textarea = gradioApp().querySelector('#extension_to_install textarea')
    textarea.value = url
	textarea.dispatchEvent(new Event("input", { bubbles: true }))

    gradioApp().querySelector('#install_extension_button').click()
}
+24 −6
Original line number Diff line number Diff line
@@ -3,8 +3,21 @@ global_progressbars = {}
galleries = {}
galleryObservers = {}

// this tracks laumnches of window.setTimeout for progressbar to prevent starting a new timeout when the previous is still running
timeoutIds = {}

function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip, id_interrupt, id_preview, id_gallery){
    var progressbar = gradioApp().getElementById(id_progressbar)
    // gradio 3.8's enlightened approach allows them to create two nested div elements inside each other with same id
    // every time you use gr.HTML(elem_id='xxx'), so we handle this here
    var progressbar = gradioApp().querySelector("#"+id_progressbar+" #"+id_progressbar)
    var progressbarParent
    if(progressbar){
        progressbarParent = gradioApp().querySelector("#"+id_progressbar)
    } else{
        progressbar = gradioApp().getElementById(id_progressbar)
        progressbarParent = null
    }

    var skip = id_skip ? gradioApp().getElementById(id_skip) : null
    var interrupt = gradioApp().getElementById(id_interrupt)
    
@@ -26,18 +39,26 @@ function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip
	    global_progressbars[id_progressbar] = progressbar

        var mutationObserver = new MutationObserver(function(m){
            if(timeoutIds[id_part]) return;

            preview = gradioApp().getElementById(id_preview)
            gallery = gradioApp().getElementById(id_gallery)

            if(preview != null && gallery != null){
                preview.style.width = gallery.clientWidth + "px"
                preview.style.height = gallery.clientHeight + "px"
                if(progressbarParent) progressbar.style.width = progressbarParent.clientWidth + "px"

				//only watch gallery if there is a generation process going on
                check_gallery(id_gallery);

                var progressDiv = gradioApp().querySelectorAll('#' + id_progressbar_span).length > 0;
                if(!progressDiv){
                if(progressDiv){
                    timeoutIds[id_part] = window.setTimeout(function() {
                        timeoutIds[id_part] = null
                        requestMoreProgress(id_part, id_progressbar_span, id_skip, id_interrupt)
                    }, 500)
                } else{
                    if (skip) {
                        skip.style.display = "none"
                    }
@@ -49,11 +70,8 @@ function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip
                        galleries[id_gallery] = null;
                    }
                }


            }

            window.setTimeout(function() { requestMoreProgress(id_part, id_progressbar_span, id_skip, id_interrupt) }, 500)
        });
        mutationObserver.observe( progressbar, { childList:true, subtree:true })
	}
+25 −4
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import shlex
import platform

dir_repos = "repositories"
dir_extensions = "extensions"
python = sys.executable
git = os.environ.get('GIT', "git")
index_url = os.environ.get('INDEX_URL', "")
@@ -16,11 +17,11 @@ def extract_arg(args, name):
    return [x for x in args if x != name], name in args


def run(command, desc=None, errdesc=None):
def run(command, desc=None, errdesc=None, custom_env=None):
    if desc is not None:
        print(desc)

    result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)

    if result.returncode != 0:

@@ -101,7 +102,25 @@ def version_check(commit):
        else:
            print("Not a git clone, can't perform version check.")
    except Exception as e:
        print("versipm check failed",e)
        print("version check failed", e)


def run_extensions_installers():
    if not os.path.isdir(dir_extensions):
        return

    for dirname_extension in os.listdir(dir_extensions):
        path_installer = os.path.join(dir_extensions, dirname_extension, "install.py")
        if not os.path.isfile(path_installer):
            continue

        try:
            env = os.environ.copy()
            env['PYTHONPATH'] = os.path.abspath(".")

            print(run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {dirname_extension}", custom_env=env))
        except Exception as e:
            print(e, file=sys.stderr)


def prepare_enviroment():
@@ -189,6 +208,8 @@ def prepare_enviroment():

    run_pip(f"install -r {requirements_file}", "requirements for Web UI")

    run_extensions_installers()

    if update_check:
        version_check(commit)
    
+2 −2
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@
    "None": "Nichts",
    "Prompt matrix": "Promptmatrix",
    "Prompts from file or textbox": "Prompts aus Datei oder Textfeld",
    "X/Y plot": "X/Y Graf",
    "X/Y plot": "X/Y Graph",
    "Put variable parts at start of prompt": "Variable teile am start des Prompt setzen",
    "Iterate seed every line": "Iterate seed every line",
    "List of prompt inputs": "List of prompt inputs",
+348 −74

File changed.

Preview size limit exceeded, changes collapsed.

Loading