Unverified Commit c2765c9b authored by MalumaDev's avatar MalumaDev Committed by GitHub
Browse files

Merge branch 'master' into test_resolve_conflicts

parents 1997ccff c1093b80
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -523,7 +523,6 @@ Affandi,0.7170285,nudity
Diane Arbus,0.655138,digipa-high-impact
Joseph Ducreux,0.65247905,digipa-high-impact
Berthe Morisot,0.7165984,fineart
Hilma AF Klint,0.71643853,scribbles
Hilma af Klint,0.71643853,scribbles
Filippino Lippi,0.7163017,fineart
Leonid Afremov,0.7163005,fineart
@@ -738,14 +737,12 @@ Abraham Mignon,0.60605425,fineart
Albert Bloch,0.69573116,nudity
Charles Dana Gibson,0.67155975,fineart
Alexandre-Évariste Fragonard,0.6507174,fineart
Alexandre-Évariste Fragonard,0.6507174,fineart
Ernst Fuchs,0.6953538,nudity
Alfredo Jaar,0.6952965,digipa-high-impact
Judy Chicago,0.6952246,weird
Frans van Mieris the Younger,0.6951849,fineart
Aertgen van Leyden,0.6951305,fineart
Emily Carr,0.69512105,fineart
Frances Macdonald,0.6950408,scribbles
Frances MacDonald,0.6950408,scribbles
Hannah Höch,0.69495845,scribbles
Gillis Rombouts,0.58770025,fineart
@@ -895,7 +892,6 @@ Richard McGuire,0.6820089,scribbles
Anni Albers,0.65708244,digipa-high-impact
Aleksey Savrasov,0.65207493,fineart
Wayne Barlowe,0.6537874,fineart
Giorgio De Chirico,0.6815907,fineart
Giorgio de Chirico,0.6815907,fineart
Ernest Procter,0.6815795,fineart
Adriaen Brouwer,0.6815058,fineart
@@ -1241,7 +1237,6 @@ Betty Churcher,0.65387225,fineart
Claes Corneliszoon Moeyaert,0.65386075,fineart
David Bomberg,0.6537477,fineart
Abraham Bosschaert,0.6535562,fineart
Giuseppe De Nittis,0.65354455,fineart
Giuseppe de Nittis,0.65354455,fineart
John La Farge,0.65342575,fineart
Frits Thaulow,0.65341854,fineart
@@ -1522,7 +1517,6 @@ Gertrude Harvey,0.5903887,fineart
Grant Wood,0.6266253,fineart
Fyodor Vasilyev,0.5234919,digipa-med-impact
Cagnaccio di San Pietro,0.6261671,fineart
Cagnaccio Di San Pietro,0.6261671,fineart
Doris Boulton-Maude,0.62593174,fineart
Adolf Hirémy-Hirschl,0.5946784,fineart
Harold von Schmidt,0.6256755,fineart
@@ -2411,7 +2405,6 @@ Hermann Feierabend,0.5346168,digipa-high-impact
Antonio Donghi,0.4610982,digipa-low-impact
Adonna Khare,0.4858036,digipa-med-impact
James Stokoe,0.5015107,digipa-med-impact
Art & Language,0.5341332,digipa-high-impact
Agustín Fernández,0.53403986,fineart
Germán Londoño,0.5338712,fineart
Emmanuelle Moureaux,0.5335641,digipa-high-impact
+32 −3
Original line number Diff line number Diff line
@@ -9,9 +9,38 @@ addEventListener('keydown', (event) => {
	let minus = "ArrowDown"
	if (event.key != plus && event.key != minus) return;

	selectionStart = target.selectionStart;
	selectionEnd = target.selectionEnd;
	if(selectionStart == selectionEnd) return;
	let selectionStart = target.selectionStart;
	let selectionEnd = target.selectionEnd;
	// If the user hasn't selected anything, let's select their current parenthesis block
	if (selectionStart === selectionEnd) {
		// Find opening parenthesis around current cursor
		const before = target.value.substring(0, selectionStart);
		let beforeParen = before.lastIndexOf("(");
		if (beforeParen == -1) return;
		let beforeParenClose = before.lastIndexOf(")");
		while (beforeParenClose !== -1 && beforeParenClose > beforeParen) {
			beforeParen = before.lastIndexOf("(", beforeParen - 1);
			beforeParenClose = before.lastIndexOf(")", beforeParenClose - 1);
		}

		// Find closing parenthesis around current cursor
		const after = target.value.substring(selectionStart);
		let afterParen = after.indexOf(")");
		if (afterParen == -1) return;
		let afterParenOpen = after.indexOf("(");
		while (afterParenOpen !== -1 && afterParen > afterParenOpen) {
			afterParen = after.indexOf(")", afterParen + 1);
			afterParenOpen = after.indexOf("(", afterParenOpen + 1);
		}
		if (beforeParen === -1 || afterParen === -1) return;

		// Set the selection to the text between the parenthesis
		const parenContent = target.value.substring(beforeParen + 1, selectionStart + afterParen);
		const lastColon = parenContent.lastIndexOf(":");
		selectionStart = beforeParen + 1;
		selectionEnd = selectionStart + lastColon;
		target.setSelectionRange(selectionStart, selectionEnd);
	}

	event.preventDefault();

+7 −0
Original line number Diff line number Diff line
// various functions for interation with ui.py not large enough to warrant putting them in separate files

function set_theme(theme){
    gradioURL = window.location.href
    if (!gradioURL.includes('?__theme=')) {
      window.location.replace(gradioURL + '?__theme=' + theme);
    }
}

function selected_gallery_index(){
    var buttons = gradioApp().querySelectorAll('[style="display: block;"].tabitem .gallery-item')
    var button = gradioApp().querySelector('[style="display: block;"].tabitem .gallery-item.\\!ring-2')
+30 −11
Original line number Diff line number Diff line
@@ -87,6 +87,23 @@ def git_clone(url, dir, name, commithash=None):
        run(f'"{git}" -C {dir} checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")

        
def version_check(commit):
    try:
        import requests
        commits = requests.get('https://api.github.com/repos/AUTOMATIC1111/stable-diffusion-webui/branches/master').json()
        if commit != "<none>" and commits['commit']['sha'] != commit:
            print("--------------------------------------------------------")
            print("| You are not up to date with the most recent release. |")
            print("| Consider running `git pull` to update.               |")
            print("--------------------------------------------------------")
        elif commits['commit']['sha'] == commit:
            print("You are up to date with the most recent release.")
        else:
            print("Not a git clone, can't perform version check.")
    except Exception as e:
        print("versipm check failed",e)

        
def prepare_enviroment():
    torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113")
    requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
@@ -110,13 +127,14 @@ def prepare_enviroment():
    codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
    blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")

    args = shlex.split(commandline_args)
    sys.argv += shlex.split(commandline_args)

    args, skip_torch_cuda_test = extract_arg(args, '--skip-torch-cuda-test')
    args, reinstall_xformers = extract_arg(args, '--reinstall-xformers')
    xformers = '--xformers' in args
    deepdanbooru = '--deepdanbooru' in args
    ngrok = '--ngrok' in args
    sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test')
    sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers')
    sys.argv, update_check = extract_arg(sys.argv, '--update-check')
    xformers = '--xformers' in sys.argv
    deepdanbooru = '--deepdanbooru' in sys.argv
    ngrok = '--ngrok' in sys.argv

    try:
        commit = run(f"{git} rev-parse HEAD").strip()
@@ -163,9 +181,10 @@ def prepare_enviroment():

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

    sys.argv += args
    if update_check:
        version_check(commit)
    
    if "--exit" in args:
    if "--exit" in sys.argv:
        print("Exiting because of --exit argument")
        exit(0)

+1 −2
Original line number Diff line number Diff line
@@ -157,8 +157,7 @@ def get_deepbooru_tags_from_model(model, tags, pil_image, threshold, deepbooru_o
    # sort by reverse by likelihood and normal for alpha, and format tag text as requested
    unsorted_tags_in_theshold.sort(key=lambda y: y[sort_ndx], reverse=(not alpha_sort))
    for weight, tag in unsorted_tags_in_theshold:
        # note: tag_outformat will still have a colon if include_ranks is True
        tag_outformat = tag.replace(':', ' ')
        tag_outformat = tag
        if use_spaces:
            tag_outformat = tag_outformat.replace('_', ' ')
        if use_escape:
Loading