ProDem commited on
Commit
2ea1be0
·
1 Parent(s): a14a342

Upload 22 files

Browse files
Files changed (22) hide show
  1. .gitignore +30 -0
  2. .pylintrc +3 -0
  3. CODEOWNERS +1 -0
  4. README.md +149 -13
  5. artists.csv +0 -0
  6. config.json +1 -0
  7. environment-wsl2.yaml +11 -0
  8. launch.py +206 -0
  9. params.txt +3 -0
  10. readme-HOWTORUN.txt +11 -0
  11. requirements.txt +26 -0
  12. requirements_versions.txt +25 -0
  13. screenshot.png +0 -0
  14. script.js +85 -0
  15. style.css +517 -0
  16. txt2img_Screenshot.png +0 -0
  17. ui-config.json +355 -0
  18. webui-user.bat +8 -0
  19. webui-user.sh +43 -0
  20. webui.bat +62 -0
  21. webui.py +162 -0
  22. webui.sh +141 -0
.gitignore ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __pycache__
2
+ *.ckpt
3
+ *.pth
4
+ /ESRGAN/*
5
+ /SwinIR/*
6
+ /repositories
7
+ /venv
8
+ /tmp
9
+ /model.ckpt
10
+ /models/**/*
11
+ /GFPGANv1.3.pth
12
+ /gfpgan/weights/*.pth
13
+ /ui-config.json
14
+ /outputs
15
+ /config.json
16
+ /log
17
+ /webui.settings.bat
18
+ /embeddings
19
+ /styles.csv
20
+ /params.txt
21
+ /styles.csv.bak
22
+ /webui-user.bat
23
+ /webui-user.sh
24
+ /interrogate
25
+ /user.css
26
+ /.idea
27
+ notification.mp3
28
+ /SwinIR
29
+ /textual_inversion
30
+ .vscode
.pylintrc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # See https://pylint.pycqa.org/en/latest/user_guide/messages/message_control.html
2
+ [MESSAGES CONTROL]
3
+ disable=C,R,W,E,I
CODEOWNERS ADDED
@@ -0,0 +1 @@
 
 
1
+ * @AUTOMATIC1111
README.md CHANGED
@@ -1,13 +1,149 @@
1
- ---
2
- title: NobelAIshare
3
- emoji: 👀
4
- colorFrom: indigo
5
- colorTo: gray
6
- sdk: gradio
7
- sdk_version: 3.6
8
- app_file: app.py
9
- pinned: false
10
- license: wtfpl
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stable Diffusion web UI
2
+ A browser interface based on Gradio library for Stable Diffusion.
3
+
4
+ ![](txt2img_Screenshot.png)
5
+
6
+ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts) wiki page for extra scripts developed by users.
7
+
8
+ ## Features
9
+ [Detailed feature showcase with images](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features):
10
+ - Original txt2img and img2img modes
11
+ - One click install and run script (but you still must install python and git)
12
+ - Outpainting
13
+ - Inpainting
14
+ - Color Sketch
15
+ - Prompt Matrix
16
+ - Stable Diffusion Upscale
17
+ - Attention, specify parts of text that the model should pay more attention to
18
+ - a man in a ((tuxedo)) - will pay more attention to tuxedo
19
+ - a man in a (tuxedo:1.21) - alternative syntax
20
+ - select text and press ctrl+up or ctrl+down to automatically adjust attention to selected text (code contributed by anonymous user)
21
+ - Loopback, run img2img processing multiple times
22
+ - X/Y plot, a way to draw a 2 dimensional plot of images with different parameters
23
+ - Textual Inversion
24
+ - have as many embeddings as you want and use any names you like for them
25
+ - use multiple embeddings with different numbers of vectors per token
26
+ - works with half precision floating point numbers
27
+ - train embeddings on 8GB (also reports of 6GB working)
28
+ - Extras tab with:
29
+ - GFPGAN, neural network that fixes faces
30
+ - CodeFormer, face restoration tool as an alternative to GFPGAN
31
+ - RealESRGAN, neural network upscaler
32
+ - ESRGAN, neural network upscaler with a lot of third party models
33
+ - SwinIR and Swin2SR([see here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/2092)), neural network upscalers
34
+ - LDSR, Latent diffusion super resolution upscaling
35
+ - Resizing aspect ratio options
36
+ - Sampling method selection
37
+ - Adjust sampler eta values (noise multiplier)
38
+ - More advanced noise setting options
39
+ - Interrupt processing at any time
40
+ - 4GB video card support (also reports of 2GB working)
41
+ - Correct seeds for batches
42
+ - Live prompt token length validation
43
+ - Generation parameters
44
+ - parameters you used to generate images are saved with that image
45
+ - in PNG chunks for PNG, in EXIF for JPEG
46
+ - can drag the image to PNG info tab to restore generation parameters and automatically copy them into UI
47
+ - can be disabled in settings
48
+ - drag and drop an image/text-parameters to promptbox
49
+ - Read Generation Parameters Button, loads parameters in promptbox to UI
50
+ - Settings page
51
+ - Running arbitrary python code from UI (must run with --allow-code to enable)
52
+ - Mouseover hints for most UI elements
53
+ - Possible to change defaults/mix/max/step values for UI elements via text config
54
+ - Random artist button
55
+ - Tiling support, a checkbox to create images that can be tiled like textures
56
+ - Progress bar and live image generation preview
57
+ - Negative prompt, an extra text field that allows you to list what you don't want to see in generated image
58
+ - Styles, a way to save part of prompt and easily apply them via dropdown later
59
+ - Variations, a way to generate same image but with tiny differences
60
+ - Seed resizing, a way to generate same image but at slightly different resolution
61
+ - CLIP interrogator, a button that tries to guess prompt from an image
62
+ - Prompt Editing, a way to change prompt mid-generation, say to start making a watermelon and switch to anime girl midway
63
+ - Batch Processing, process a group of files using img2img
64
+ - Img2img Alternative, reverse Euler method of cross attention control
65
+ - Highres Fix, a convenience option to produce high resolution pictures in one click without usual distortions
66
+ - Reloading checkpoints on the fly
67
+ - Checkpoint Merger, a tab that allows you to merge up to 3 checkpoints into one
68
+ - [Custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts) with many extensions from community
69
+ - [Composable-Diffusion](https://energy-based-model.github.io/Compositional-Visual-Generation-with-Composable-Diffusion-Models/), a way to use multiple prompts at once
70
+ - separate prompts using uppercase `AND`
71
+ - also supports weights for prompts: `a cat :1.2 AND a dog AND a penguin :2.2`
72
+ - No token limit for prompts (original stable diffusion lets you use up to 75 tokens)
73
+ - DeepDanbooru integration, creates danbooru style tags for anime prompts (add --deepdanbooru to commandline args)
74
+ - [xformers](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers), major speed increase for select cards: (add --xformers to commandline args)
75
+ - History tab: view, direct and delete images conveniently within the UI
76
+ - Generate forever option
77
+ - Training tab
78
+ - hypernetworks and embeddings options
79
+ - Preprocessing images: cropping, mirroring, autotagging using BLIP or deepdanbooru (for anime)
80
+ - Clip skip
81
+ - Use Hypernetworks
82
+ - Use VAEs
83
+ - Estimated completion time in progress bar
84
+ - API
85
+ - Support for dedicated [inpainting model](https://github.com/runwayml/stable-diffusion#inpainting-with-stable-diffusion) by RunwayML.
86
+ - Aesthetic Gradients, a way to generate images with a specific aesthetic by using clip images embds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
87
+
88
+
89
+ ## Installation and Running
90
+ Make sure the required [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) are met and follow the instructions available for both [NVidia](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs) (recommended) and [AMD](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-AMD-GPUs) GPUs.
91
+
92
+ Alternatively, use online services (like Google Colab):
93
+
94
+ - [List of Online Services](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Online-Services)
95
+
96
+ ### Automatic Installation on Windows
97
+ 1. Install [Python 3.10.6](https://www.python.org/downloads/windows/), checking "Add Python to PATH"
98
+ 2. Install [git](https://git-scm.com/download/win).
99
+ 3. Download the stable-diffusion-webui repository, for example by running `git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git`.
100
+ 4. Place `model.ckpt` in the `models` directory (see [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) for where to get it).
101
+ 5. _*(Optional)*_ Place `GFPGANv1.4.pth` in the base directory, alongside `webui.py` (see [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) for where to get it).
102
+ 6. Run `webui-user.bat` from Windows Explorer as normal, non-administrator, user.
103
+
104
+ ### Automatic Installation on Linux
105
+ 1. Install the dependencies:
106
+ ```bash
107
+ # Debian-based:
108
+ sudo apt install wget git python3 python3-venv
109
+ # Red Hat-based:
110
+ sudo dnf install wget git python3
111
+ # Arch-based:
112
+ sudo pacman -S wget git python3
113
+ ```
114
+ 2. To install in `/home/$(whoami)/stable-diffusion-webui/`, run:
115
+ ```bash
116
+ bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
117
+ ```
118
+
119
+ ### Installation on Apple Silicon
120
+
121
+ Find the instructions [here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon).
122
+
123
+ ## Contributing
124
+ Here's how to add code to this repo: [Contributing](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Contributing)
125
+
126
+ ## Documentation
127
+ The documentation was moved from this README over to the project's [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki).
128
+
129
+ ## Credits
130
+ - Stable Diffusion - https://github.com/CompVis/stable-diffusion, https://github.com/CompVis/taming-transformers
131
+ - k-diffusion - https://github.com/crowsonkb/k-diffusion.git
132
+ - GFPGAN - https://github.com/TencentARC/GFPGAN.git
133
+ - CodeFormer - https://github.com/sczhou/CodeFormer
134
+ - ESRGAN - https://github.com/xinntao/ESRGAN
135
+ - SwinIR - https://github.com/JingyunLiang/SwinIR
136
+ - Swin2SR - https://github.com/mv-lab/swin2sr
137
+ - LDSR - https://github.com/Hafiidz/latent-diffusion
138
+ - Ideas for optimizations - https://github.com/basujindal/stable-diffusion
139
+ - Doggettx - Cross Attention layer optimization - https://github.com/Doggettx/stable-diffusion, original idea for prompt editing.
140
+ - InvokeAI, lstein - Cross Attention layer optimization - https://github.com/invoke-ai/InvokeAI (originally http://github.com/lstein/stable-diffusion)
141
+ - Rinon Gal - Textual Inversion - https://github.com/rinongal/textual_inversion (we're not using his code, but we are using his ideas).
142
+ - Idea for SD upscale - https://github.com/jquesnelle/txt2imghd
143
+ - Noise generation for outpainting mk2 - https://github.com/parlance-zz/g-diffuser-bot
144
+ - CLIP interrogator idea and borrowing some code - https://github.com/pharmapsychotic/clip-interrogator
145
+ - Idea for Composable Diffusion - https://github.com/energy-based-model/Compositional-Visual-Generation-with-Composable-Diffusion-Models-PyTorch
146
+ - xformers - https://github.com/facebookresearch/xformers
147
+ - DeepDanbooru - interrogator for anime diffusers https://github.com/KichangKim/DeepDanbooru
148
+ - Initial Gradio script - posted on 4chan by an Anonymous user. Thank you Anonymous user.
149
+ - (You)
artists.csv ADDED
The diff for this file is too large to render. See raw diff
 
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"samples_save": true, "samples_format": "png", "samples_filename_pattern": "", "grid_save": true, "grid_format": "png", "grid_extended_filename": false, "grid_only_if_multiple": true, "grid_prevent_empty_spots": false, "n_rows": -1, "enable_pnginfo": true, "save_txt": false, "save_images_before_face_restoration": false, "jpeg_quality": 80, "export_for_4chan": true, "use_original_name_batch": false, "save_selected_only": true, "do_not_add_watermark": false, "outdir_samples": "", "outdir_txt2img_samples": "outputs/txt2img-images", "outdir_img2img_samples": "outputs/img2img-images", "outdir_extras_samples": "outputs/extras-images", "outdir_grids": "", "outdir_txt2img_grids": "outputs/txt2img-grids", "outdir_img2img_grids": "outputs/img2img-grids", "outdir_save": "log/images", "save_to_dirs": false, "grid_save_to_dirs": false, "use_save_to_dirs_for_ui": false, "directories_filename_pattern": "", "directories_max_prompt_words": 8, "ESRGAN_tile": 192, "ESRGAN_tile_overlap": 8, "realesrgan_enabled_models": ["R-ESRGAN x4+", "R-ESRGAN x4+ Anime6B"], "SWIN_tile": 192, "SWIN_tile_overlap": 8, "ldsr_steps": 100, "upscaler_for_img2img": null, "use_scale_latent_for_hires_fix": false, "face_restoration_model": null, "code_former_weight": 0.5, "face_restoration_unload": false, "memmon_poll_rate": 8, "samples_log_stdout": false, "multiple_tqdm": true, "unload_models_when_training": false, "dataset_filename_word_regex": "", "dataset_filename_join_string": " ", "training_image_repeats_per_epoch": 1, "training_write_csv_every": 500, "sd_model_checkpoint": null, "sd_checkpoint_cache": 0, "sd_hypernetwork": "None", "sd_hypernetwork_strength": 1.0, "img2img_color_correction": false, "save_images_before_color_correction": false, "img2img_fix_steps": false, "enable_quantization": false, "enable_emphasis": true, "use_old_emphasis_implementation": false, "enable_batch_seeds": true, "comma_padding_backtrack": 20, "filter_nsfw": false, "CLIP_stop_at_last_layers": 1, "random_artist_categories": [], "interrogate_keep_models_in_memory": false, "interrogate_use_builtin_artists": true, "interrogate_return_ranks": false, "interrogate_clip_num_beams": 1, "interrogate_clip_min_length": 24, "interrogate_clip_max_length": 48, "interrogate_clip_dict_limit": 1500, "interrogate_deepbooru_score_threshold": 0.5, "deepbooru_sort_alpha": true, "deepbooru_use_spaces": false, "deepbooru_escape": true, "show_progressbar": true, "show_progress_every_n_steps": 0, "return_grid": true, "do_not_show_images": false, "add_model_hash_to_info": true, "add_model_name_to_info": false, "disable_weights_auto_swap": false, "font": "", "js_modal_lightbox": true, "js_modal_lightbox_initially_zoomed": true, "show_progress_in_title": true, "quicksettings": "sd_model_checkpoint", "localization": "None", "hide_samplers": [], "eta_ddim": 0.0, "eta_ancestral": 1.0, "ddim_discretize": "uniform", "s_churn": 0.0, "s_tmin": 0.0, "s_noise": 1.0, "eta_noise_seed_delta": 0}
environment-wsl2.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: automatic
2
+ channels:
3
+ - pytorch
4
+ - defaults
5
+ dependencies:
6
+ - python=3.10
7
+ - pip=22.2.2
8
+ - cudatoolkit=11.3
9
+ - pytorch=1.12.1
10
+ - torchvision=0.13.1
11
+ - numpy=1.23.1
launch.py ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # this scripts installs necessary requirements and launches main program in webui.py
2
+ import subprocess
3
+ import os
4
+ import sys
5
+ import importlib.util
6
+ import shlex
7
+ import platform
8
+
9
+ dir_repos = "repositories"
10
+ python = sys.executable
11
+ git = os.environ.get('GIT', "git")
12
+ index_url = os.environ.get('INDEX_URL', "")
13
+
14
+
15
+ def extract_arg(args, name):
16
+ return [x for x in args if x != name], name in args
17
+
18
+
19
+ def run(command, desc=None, errdesc=None):
20
+ if desc is not None:
21
+ print(desc)
22
+
23
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
24
+
25
+ if result.returncode != 0:
26
+
27
+ message = f"""{errdesc or 'Error running command'}.
28
+ Command: {command}
29
+ Error code: {result.returncode}
30
+ stdout: {result.stdout.decode(encoding="utf8", errors="ignore") if len(result.stdout)>0 else '<empty>'}
31
+ stderr: {result.stderr.decode(encoding="utf8", errors="ignore") if len(result.stderr)>0 else '<empty>'}
32
+ """
33
+ raise RuntimeError(message)
34
+
35
+ return result.stdout.decode(encoding="utf8", errors="ignore")
36
+
37
+
38
+ def check_run(command):
39
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
40
+ return result.returncode == 0
41
+
42
+
43
+ def is_installed(package):
44
+ try:
45
+ spec = importlib.util.find_spec(package)
46
+ except ModuleNotFoundError:
47
+ return False
48
+
49
+ return spec is not None
50
+
51
+
52
+ def repo_dir(name):
53
+ return os.path.join(dir_repos, name)
54
+
55
+
56
+ def run_python(code, desc=None, errdesc=None):
57
+ return run(f'"{python}" -c "{code}"', desc, errdesc)
58
+
59
+
60
+ def run_pip(args, desc=None):
61
+ index_url_line = f' --index-url {index_url}' if index_url != '' else ''
62
+ return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
63
+
64
+
65
+ def check_run_python(code):
66
+ return check_run(f'"{python}" -c "{code}"')
67
+
68
+
69
+ def git_clone(url, dir, name, commithash=None):
70
+ # TODO clone into temporary dir and move if successful
71
+
72
+ if os.path.exists(dir):
73
+ if commithash is None:
74
+ return
75
+
76
+ current_hash = run(f'"{git}" -C {dir} rev-parse HEAD', None, f"Couldn't determine {name}'s hash: {commithash}").strip()
77
+ if current_hash == commithash:
78
+ return
79
+
80
+ run(f'"{git}" -C {dir} fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")
81
+ run(f'"{git}" -C {dir} checkout {commithash}', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}")
82
+ return
83
+
84
+ run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}")
85
+
86
+ if commithash is not None:
87
+ run(f'"{git}" -C {dir} checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
88
+
89
+
90
+ def version_check(commit):
91
+ try:
92
+ import requests
93
+ commits = requests.get('https://api.github.com/repos/AUTOMATIC1111/stable-diffusion-webui/branches/master').json()
94
+ if commit != "<none>" and commits['commit']['sha'] != commit:
95
+ print("--------------------------------------------------------")
96
+ print("| You are not up to date with the most recent release. |")
97
+ print("| Consider running `git pull` to update. |")
98
+ print("--------------------------------------------------------")
99
+ elif commits['commit']['sha'] == commit:
100
+ print("You are up to date with the most recent release.")
101
+ else:
102
+ print("Not a git clone, can't perform version check.")
103
+ except Exception as e:
104
+ print("versipm check failed",e)
105
+
106
+
107
+ def prepare_enviroment():
108
+ 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")
109
+ requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
110
+ commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
111
+
112
+ gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379")
113
+ clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1")
114
+ deepdanbooru_package = os.environ.get('DEEPDANBOORU_PACKAGE', "git+https://github.com/KichangKim/DeepDanbooru.git@edf73df4cdaeea2cf00e9ac08bd8a9026b7a7b26")
115
+
116
+ xformers_windows_package = os.environ.get('XFORMERS_WINDOWS_PACKAGE', 'https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl')
117
+
118
+ stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://github.com/CompVis/stable-diffusion.git")
119
+ taming_transformers_repo = os.environ.get('TAMING_REANSFORMERS_REPO', "https://github.com/CompVis/taming-transformers.git")
120
+ k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'https://github.com/crowsonkb/k-diffusion.git')
121
+ codeformer_repo = os.environ.get('CODEFORMET_REPO', 'https://github.com/sczhou/CodeFormer.git')
122
+ blip_repo = os.environ.get('BLIP_REPO', 'https://github.com/salesforce/BLIP.git')
123
+
124
+ stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc")
125
+ taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6")
126
+ k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "f4e99857772fc3a126ba886aadf795a332774878")
127
+ codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
128
+ blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
129
+
130
+ sys.argv += shlex.split(commandline_args)
131
+
132
+ sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test')
133
+ sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers')
134
+ sys.argv, update_check = extract_arg(sys.argv, '--update-check')
135
+ xformers = '--xformers' in sys.argv
136
+ deepdanbooru = '--deepdanbooru' in sys.argv
137
+ ngrok = '--ngrok' in sys.argv
138
+
139
+ try:
140
+ commit = run(f"{git} rev-parse HEAD").strip()
141
+ except Exception:
142
+ commit = "<none>"
143
+
144
+ print(f"Python {sys.version}")
145
+ print(f"Commit hash: {commit}")
146
+
147
+ if not is_installed("torch") or not is_installed("torchvision"):
148
+ run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
149
+
150
+ if not skip_torch_cuda_test:
151
+ run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")
152
+
153
+ if not is_installed("gfpgan"):
154
+ run_pip(f"install {gfpgan_package}", "gfpgan")
155
+
156
+ if not is_installed("clip"):
157
+ run_pip(f"install {clip_package}", "clip")
158
+
159
+ if (not is_installed("xformers") or reinstall_xformers) and xformers:
160
+ if platform.system() == "Windows":
161
+ if platform.python_version().startswith("3.10"):
162
+ run_pip(f"install -U -I --no-deps {xformers_windows_package}", "xformers")
163
+ else:
164
+ print("Installation of xformers is not supported in this version of Python.")
165
+ print("You can also check this and build manually: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers#building-xformers-on-windows-by-duckness")
166
+ if not is_installed("xformers"):
167
+ exit(0)
168
+ elif platform.system() == "Linux":
169
+ run_pip("install xformers", "xformers")
170
+
171
+ if not is_installed("deepdanbooru") and deepdanbooru:
172
+ run_pip(f"install {deepdanbooru_package}#egg=deepdanbooru[tensorflow] tensorflow==2.10.0 tensorflow-io==0.27.0", "deepdanbooru")
173
+
174
+ if not is_installed("pyngrok") and ngrok:
175
+ run_pip("install pyngrok", "ngrok")
176
+
177
+ os.makedirs(dir_repos, exist_ok=True)
178
+
179
+ git_clone(stable_diffusion_repo, repo_dir('stable-diffusion'), "Stable Diffusion", stable_diffusion_commit_hash)
180
+ git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
181
+ git_clone(k_diffusion_repo, repo_dir('k-diffusion'), "K-diffusion", k_diffusion_commit_hash)
182
+ git_clone(codeformer_repo, repo_dir('CodeFormer'), "CodeFormer", codeformer_commit_hash)
183
+ git_clone(blip_repo, repo_dir('BLIP'), "BLIP", blip_commit_hash)
184
+
185
+ if not is_installed("lpips"):
186
+ run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}", "requirements for CodeFormer")
187
+
188
+ run_pip(f"install -r {requirements_file}", "requirements for Web UI")
189
+
190
+ if update_check:
191
+ version_check(commit)
192
+
193
+ if "--exit" in sys.argv:
194
+ print("Exiting because of --exit argument")
195
+ exit(0)
196
+
197
+
198
+ def start_webui():
199
+ print(f"Launching Web UI with arguments: {' '.join(sys.argv[1:])}")
200
+ import webui
201
+ webui.webui()
202
+
203
+
204
+ if __name__ == "__main__":
205
+ prepare_enviroment()
206
+ start_webui()
params.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ black woman
2
+ Negative prompt: nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
3
+ Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: -1, Size: 512x512, Model hash: 1d4a34af
readme-HOWTORUN.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1. launch webui.bat
2
+ 2. In the browser, access 127.0.0.1:7860
3
+
4
+
5
+ * P.S.
6
+ For better quality, use negative prompts
7
+ guide: https://arca.live/b/aiart/60182179?mode=best&p=1
8
+
9
+ nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry
10
+
11
+ Steps: 28, Sampler: Euler a, CFG scale: 11, Size: 512x768
requirements.txt ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ basicsr
2
+ diffusers
3
+ fairscale==0.4.4
4
+ fonts
5
+ font-roboto
6
+ gfpgan
7
+ gradio==3.5
8
+ invisible-watermark
9
+ numpy
10
+ omegaconf
11
+ piexif
12
+ Pillow
13
+ pytorch_lightning
14
+ realesrgan
15
+ scikit-image>=0.19
16
+ timm==0.4.12
17
+ transformers==4.19.2
18
+ torch
19
+ einops
20
+ jsonmerge
21
+ clean-fid
22
+ resize-right
23
+ torchdiffeq
24
+ kornia
25
+ lark
26
+ inflection
requirements_versions.txt ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ transformers==4.19.2
2
+ diffusers==0.3.0
3
+ basicsr==1.4.2
4
+ gfpgan==1.3.8
5
+ gradio==3.5
6
+ numpy==1.23.3
7
+ Pillow==9.2.0
8
+ realesrgan==0.3.0
9
+ torch
10
+ omegaconf==2.2.3
11
+ pytorch_lightning==1.7.6
12
+ scikit-image==0.19.2
13
+ fonts
14
+ font-roboto
15
+ timm==0.6.7
16
+ fairscale==0.4.9
17
+ piexif==1.1.3
18
+ einops==0.4.1
19
+ jsonmerge==1.8.0
20
+ clean-fid==0.1.29
21
+ resize-right==0.0.2
22
+ torchdiffeq==0.2.3
23
+ kornia==0.6.7
24
+ lark==1.1.2
25
+ inflection==0.5.1
screenshot.png ADDED
script.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function gradioApp(){
2
+ return document.getElementsByTagName('gradio-app')[0].shadowRoot;
3
+ }
4
+
5
+ function get_uiCurrentTab() {
6
+ return gradioApp().querySelector('.tabs button:not(.border-transparent)')
7
+ }
8
+
9
+ function get_uiCurrentTabContent() {
10
+ return gradioApp().querySelector('.tabitem[id^=tab_]:not([style*="display: none"])')
11
+ }
12
+
13
+ uiUpdateCallbacks = []
14
+ uiTabChangeCallbacks = []
15
+ let uiCurrentTab = null
16
+
17
+ function onUiUpdate(callback){
18
+ uiUpdateCallbacks.push(callback)
19
+ }
20
+ function onUiTabChange(callback){
21
+ uiTabChangeCallbacks.push(callback)
22
+ }
23
+
24
+ function runCallback(x, m){
25
+ try {
26
+ x(m)
27
+ } catch (e) {
28
+ (console.error || console.log).call(console, e.message, e);
29
+ }
30
+ }
31
+ function executeCallbacks(queue, m) {
32
+ queue.forEach(function(x){runCallback(x, m)})
33
+ }
34
+
35
+ document.addEventListener("DOMContentLoaded", function() {
36
+ var mutationObserver = new MutationObserver(function(m){
37
+ executeCallbacks(uiUpdateCallbacks, m);
38
+ const newTab = get_uiCurrentTab();
39
+ if ( newTab && ( newTab !== uiCurrentTab ) ) {
40
+ uiCurrentTab = newTab;
41
+ executeCallbacks(uiTabChangeCallbacks);
42
+ }
43
+ });
44
+ mutationObserver.observe( gradioApp(), { childList:true, subtree:true })
45
+ });
46
+
47
+ /**
48
+ * Add a ctrl+enter as a shortcut to start a generation
49
+ */
50
+ document.addEventListener('keydown', function(e) {
51
+ var handled = false;
52
+ if (e.key !== undefined) {
53
+ if((e.key == "Enter" && (e.metaKey || e.ctrlKey || e.altKey))) handled = true;
54
+ } else if (e.keyCode !== undefined) {
55
+ if((e.keyCode == 13 && (e.metaKey || e.ctrlKey || e.altKey))) handled = true;
56
+ }
57
+ if (handled) {
58
+ button = get_uiCurrentTabContent().querySelector('button[id$=_generate]');
59
+ if (button) {
60
+ button.click();
61
+ }
62
+ e.preventDefault();
63
+ }
64
+ })
65
+
66
+ /**
67
+ * checks that a UI element is not in another hidden element or tab content
68
+ */
69
+ function uiElementIsVisible(el) {
70
+ let isVisible = !el.closest('.\\!hidden');
71
+ if ( ! isVisible ) {
72
+ return false;
73
+ }
74
+
75
+ while( isVisible = el.closest('.tabitem')?.style.display !== 'none' ) {
76
+ if ( ! isVisible ) {
77
+ return false;
78
+ } else if ( el.parentElement ) {
79
+ el = el.parentElement
80
+ } else {
81
+ break;
82
+ }
83
+ }
84
+ return isVisible;
85
+ }
style.css ADDED
@@ -0,0 +1,517 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .container {
2
+ max-width: 100%;
3
+ }
4
+
5
+ #txt2img_token_counter {
6
+ height: 0px;
7
+ }
8
+
9
+ #img2img_token_counter {
10
+ height: 0px;
11
+ }
12
+
13
+ #sh{
14
+ min-width: 2em;
15
+ min-height: 2em;
16
+ max-width: 2em;
17
+ max-height: 2em;
18
+ flex-grow: 0;
19
+ padding-left: 0.25em;
20
+ padding-right: 0.25em;
21
+ margin: 0.1em 0;
22
+ opacity: 0%;
23
+ cursor: default;
24
+ }
25
+
26
+ .output-html p {margin: 0 0.5em;}
27
+
28
+ .row > *,
29
+ .row > .gr-form > * {
30
+ min-width: min(120px, 100%);
31
+ flex: 1 1 0%;
32
+ }
33
+
34
+ .performance {
35
+ font-size: 0.85em;
36
+ color: #444;
37
+ }
38
+
39
+ .performance p{
40
+ display: inline-block;
41
+ }
42
+
43
+ .performance .time {
44
+ margin-right: 0;
45
+ }
46
+
47
+ .performance .vram {
48
+ }
49
+
50
+ #txt2img_generate, #img2img_generate {
51
+ min-height: 4.5em;
52
+ }
53
+
54
+ @media screen and (min-width: 2500px) {
55
+ #txt2img_gallery, #img2img_gallery {
56
+ min-height: 768px;
57
+ }
58
+ }
59
+
60
+ #txt2img_gallery img, #img2img_gallery img{
61
+ object-fit: scale-down;
62
+ }
63
+
64
+ .justify-center.overflow-x-scroll {
65
+ justify-content: left;
66
+ }
67
+
68
+ .justify-center.overflow-x-scroll button:first-of-type {
69
+ margin-left: auto;
70
+ }
71
+
72
+ .justify-center.overflow-x-scroll button:last-of-type {
73
+ margin-right: auto;
74
+ }
75
+
76
+ #random_seed, #random_subseed, #reuse_seed, #reuse_subseed, #open_folder{
77
+ min-width: auto;
78
+ flex-grow: 0;
79
+ padding-left: 0.25em;
80
+ padding-right: 0.25em;
81
+ }
82
+
83
+ #hidden_element{
84
+ display: none;
85
+ }
86
+
87
+ #seed_row, #subseed_row{
88
+ gap: 0.5rem;
89
+ }
90
+
91
+ #subseed_show_box{
92
+ min-width: auto;
93
+ flex-grow: 0;
94
+ }
95
+
96
+ #subseed_show_box > div{
97
+ border: 0;
98
+ height: 100%;
99
+ }
100
+
101
+ #subseed_show{
102
+ min-width: auto;
103
+ flex-grow: 0;
104
+ padding: 0;
105
+ }
106
+
107
+ #subseed_show label{
108
+ height: 100%;
109
+ }
110
+
111
+ #roll_col{
112
+ min-width: unset !important;
113
+ flex-grow: 0 !important;
114
+ padding: 0.4em 0;
115
+ }
116
+
117
+ #roll, #paste, #style_create, #style_apply{
118
+ min-width: 2em;
119
+ min-height: 2em;
120
+ max-width: 2em;
121
+ max-height: 2em;
122
+ flex-grow: 0;
123
+ padding-left: 0.25em;
124
+ padding-right: 0.25em;
125
+ margin: 0.1em 0;
126
+ }
127
+
128
+ #interrogate_col{
129
+ min-width: 0 !important;
130
+ max-width: 8em !important;
131
+ }
132
+ #interrogate, #deepbooru{
133
+ margin: 0em 0.25em 0.9em 0.25em;
134
+ min-width: 8em;
135
+ max-width: 8em;
136
+ }
137
+
138
+ #style_pos_col, #style_neg_col{
139
+ min-width: 8em !important;
140
+ }
141
+
142
+ #txt2img_style_index, #txt2img_style2_index, #img2img_style_index, #img2img_style2_index{
143
+ margin-top: 1em;
144
+ }
145
+
146
+ .gr-form{
147
+ background: transparent;
148
+ }
149
+
150
+ .my-4{
151
+ margin-top: 0;
152
+ margin-bottom: 0;
153
+ }
154
+
155
+ #toprow div{
156
+ border: none;
157
+ gap: 0;
158
+ background: transparent;
159
+ }
160
+
161
+ #resize_mode{
162
+ flex: 1.5;
163
+ }
164
+
165
+ button{
166
+ align-self: stretch !important;
167
+ }
168
+
169
+ .overflow-hidden, .gr-panel{
170
+ overflow: visible !important;
171
+ }
172
+
173
+ #x_type, #y_type{
174
+ max-width: 10em;
175
+ }
176
+
177
+ #txt2img_preview, #img2img_preview, #ti_preview{
178
+ position: absolute;
179
+ width: 320px;
180
+ left: 0;
181
+ right: 0;
182
+ margin-left: auto;
183
+ margin-right: auto;
184
+ margin-top: 34px;
185
+ z-index: 100;
186
+ border: none;
187
+ border-top-left-radius: 0;
188
+ border-top-right-radius: 0;
189
+ }
190
+
191
+ @media screen and (min-width: 768px) {
192
+ #txt2img_preview, #img2img_preview, #ti_preview {
193
+ position: absolute;
194
+ }
195
+ }
196
+
197
+ @media screen and (max-width: 767px) {
198
+ #txt2img_preview, #img2img_preview, #ti_preview {
199
+ position: relative;
200
+ }
201
+ }
202
+
203
+ #txt2img_preview div.left-0.top-0, #img2img_preview div.left-0.top-0, #ti_preview div.left-0.top-0{
204
+ display: none;
205
+ }
206
+
207
+ fieldset span.text-gray-500, .gr-block.gr-box span.text-gray-500, label.block span{
208
+ position: absolute;
209
+ top: -0.6em;
210
+ line-height: 1.2em;
211
+ padding: 0 0.5em;
212
+ margin: 0;
213
+
214
+ background-color: white;
215
+ border-top: 1px solid #eee;
216
+ border-left: 1px solid #eee;
217
+ border-right: 1px solid #eee;
218
+
219
+ z-index: 300;
220
+ }
221
+
222
+ .dark fieldset span.text-gray-500, .dark .gr-block.gr-box span.text-gray-500, .dark label.block span{
223
+ background-color: rgb(31, 41, 55);
224
+ border-top: 1px solid rgb(55 65 81);
225
+ border-left: 1px solid rgb(55 65 81);
226
+ border-right: 1px solid rgb(55 65 81);
227
+ }
228
+
229
+ #settings fieldset span.text-gray-500, #settings .gr-block.gr-box span.text-gray-500, #settings label.block span{
230
+ position: relative;
231
+ border: none;
232
+ margin-right: 8em;
233
+ }
234
+
235
+ .gr-panel div.flex-col div.justify-between label span{
236
+ margin: 0;
237
+ }
238
+
239
+ #settings .gr-panel div.flex-col div.justify-between div{
240
+ position: relative;
241
+ z-index: 200;
242
+ }
243
+
244
+ input[type="range"]{
245
+ margin: 0.5em 0 -0.3em 0;
246
+ }
247
+
248
+ #txt2img_sampling label{
249
+ padding-left: 0.6em;
250
+ padding-right: 0.6em;
251
+ }
252
+
253
+ #mask_bug_info {
254
+ text-align: center;
255
+ display: block;
256
+ margin-top: -0.75em;
257
+ margin-bottom: -0.75em;
258
+ }
259
+
260
+ #txt2img_negative_prompt, #img2img_negative_prompt{
261
+ }
262
+
263
+ #txt2img_progressbar, #img2img_progressbar, #ti_progressbar{
264
+ position: absolute;
265
+ z-index: 1000;
266
+ right: 0;
267
+ padding-left: 5px;
268
+ padding-right: 5px;
269
+ display: block;
270
+ }
271
+
272
+ #txt2img_progress_row, #img2img_progress_row{
273
+ margin-bottom: 10px;
274
+ margin-top: -18px;
275
+ }
276
+
277
+ .progressDiv{
278
+ width: 100%;
279
+ height: 20px;
280
+ background: #b4c0cc;
281
+ border-radius: 8px;
282
+ }
283
+
284
+ .dark .progressDiv{
285
+ background: #424c5b;
286
+ }
287
+
288
+ .progressDiv .progress{
289
+ width: 0%;
290
+ height: 20px;
291
+ background: #0060df;
292
+ color: white;
293
+ font-weight: bold;
294
+ line-height: 20px;
295
+ padding: 0 8px 0 0;
296
+ text-align: right;
297
+ border-radius: 8px;
298
+ }
299
+
300
+ #lightboxModal{
301
+ display: none;
302
+ position: fixed;
303
+ z-index: 1001;
304
+ padding-top: 100px;
305
+ left: 0;
306
+ top: 0;
307
+ width: 100%;
308
+ height: 100%;
309
+ overflow: auto;
310
+ background-color: rgba(20, 20, 20, 0.95);
311
+ user-select: none;
312
+ -webkit-user-select: none;
313
+ }
314
+
315
+ .modalControls {
316
+ display: grid;
317
+ grid-template-columns: 32px auto 1fr 32px;
318
+ grid-template-areas: "zoom tile space close";
319
+ position: absolute;
320
+ top: 0;
321
+ left: 0;
322
+ right: 0;
323
+ padding: 16px;
324
+ gap: 16px;
325
+ background-color: rgba(0,0,0,0.2);
326
+ }
327
+
328
+ .modalClose {
329
+ grid-area: close;
330
+ }
331
+
332
+ .modalZoom {
333
+ grid-area: zoom;
334
+ }
335
+
336
+ .modalTileImage {
337
+ grid-area: tile;
338
+ }
339
+
340
+ .modalClose,
341
+ .modalZoom,
342
+ .modalTileImage {
343
+ color: white;
344
+ font-size: 35px;
345
+ font-weight: bold;
346
+ cursor: pointer;
347
+ }
348
+
349
+ .modalClose:hover,
350
+ .modalClose:focus,
351
+ .modalZoom:hover,
352
+ .modalZoom:focus {
353
+ color: #999;
354
+ text-decoration: none;
355
+ cursor: pointer;
356
+ }
357
+
358
+ #modalImage {
359
+ display: block;
360
+ margin-left: auto;
361
+ margin-right: auto;
362
+ margin-top: auto;
363
+ width: auto;
364
+ }
365
+
366
+ .modalImageFullscreen {
367
+ object-fit: contain;
368
+ height: 90%;
369
+ }
370
+
371
+ .modalPrev,
372
+ .modalNext {
373
+ cursor: pointer;
374
+ position: absolute;
375
+ top: 50%;
376
+ width: auto;
377
+ padding: 16px;
378
+ margin-top: -50px;
379
+ color: white;
380
+ font-weight: bold;
381
+ font-size: 20px;
382
+ transition: 0.6s ease;
383
+ border-radius: 0 3px 3px 0;
384
+ user-select: none;
385
+ -webkit-user-select: none;
386
+ }
387
+
388
+ .modalNext {
389
+ right: 0;
390
+ border-radius: 3px 0 0 3px;
391
+ }
392
+
393
+ .modalPrev:hover,
394
+ .modalNext:hover {
395
+ background-color: rgba(0, 0, 0, 0.8);
396
+ }
397
+
398
+ #imageARPreview{
399
+ position:absolute;
400
+ top:0px;
401
+ left:0px;
402
+ border:2px solid red;
403
+ background:rgba(255, 0, 0, 0.3);
404
+ z-index: 900;
405
+ pointer-events:none;
406
+ display:none
407
+ }
408
+
409
+ #txt2img_interrupt, #img2img_interrupt{
410
+ position: absolute;
411
+ width: 50%;
412
+ height: 72px;
413
+ background: #b4c0cc;
414
+ border-radius: 0px;
415
+ display: none;
416
+ }
417
+
418
+ #txt2img_skip, #img2img_skip{
419
+ position: absolute;
420
+ width: 50%;
421
+ right: 0px;
422
+ height: 72px;
423
+ background: #b4c0cc;
424
+ border-radius: 0px;
425
+ display: none;
426
+ }
427
+
428
+ .red {
429
+ color: red;
430
+ }
431
+
432
+ .gallery-item {
433
+ --tw-bg-opacity: 0 !important;
434
+ }
435
+
436
+ #context-menu{
437
+ z-index:9999;
438
+ position:absolute;
439
+ display:block;
440
+ padding:0px 0;
441
+ border:2px solid #a55000;
442
+ border-radius:8px;
443
+ box-shadow:1px 1px 2px #CE6400;
444
+ width: 200px;
445
+ }
446
+
447
+ .context-menu-items{
448
+ list-style: none;
449
+ margin: 0;
450
+ padding: 0;
451
+ }
452
+
453
+ .context-menu-items a{
454
+ display:block;
455
+ padding:5px;
456
+ cursor:pointer;
457
+ }
458
+
459
+ .context-menu-items a:hover{
460
+ background: #a55000;
461
+ }
462
+
463
+ #quicksettings {
464
+ gap: 0.4em;
465
+ }
466
+
467
+ #quicksettings > div{
468
+ border: none;
469
+ background: none;
470
+ flex: unset;
471
+ gap: 0.5em;
472
+ }
473
+
474
+ #quicksettings > div > div{
475
+ max-width: 32em;
476
+ min-width: 24em;
477
+ padding: 0;
478
+ }
479
+
480
+ #refresh_sd_model_checkpoint, #refresh_sd_hypernetwork, #refresh_train_hypernetwork_name, #refresh_train_embedding_name, #refresh_localization, #refresh_aesthetic_embeddings{
481
+ max-width: 2.5em;
482
+ min-width: 2.5em;
483
+ height: 2.4em;
484
+ }
485
+
486
+
487
+ canvas[key="mask"] {
488
+ z-index: 12 !important;
489
+ filter: invert();
490
+ mix-blend-mode: multiply;
491
+ pointer-events: none;
492
+ }
493
+
494
+
495
+ /* gradio 3.4.1 stuff for editable scrollbar values */
496
+ .gr-box > div > div > input.gr-text-input{
497
+ position: absolute;
498
+ right: 0.5em;
499
+ top: -0.6em;
500
+ z-index: 200;
501
+ width: 8em;
502
+ }
503
+ #quicksettings .gr-box > div > div > input.gr-text-input {
504
+ top: -1.12em;
505
+ }
506
+
507
+ .row.gr-compact{
508
+ overflow: visible;
509
+ }
510
+
511
+ #img2img_image, #img2img_image > .h-60, #img2img_image > .h-60 > div, #img2img_image > .h-60 > div > img,
512
+ img2maskimg, #img2maskimg > .h-60, #img2maskimg > .h-60 > div, #img2maskimg > .h-60 > div > img
513
+ {
514
+ height: 480px !important;
515
+ max-height: 480px !important;
516
+ min-height: 480px !important;
517
+ }
txt2img_Screenshot.png ADDED
ui-config.json ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "txt2img/Prompt/visible": true,
3
+ "txt2img/Prompt/value": "",
4
+ "txt2img/Negative prompt/visible": true,
5
+ "txt2img/Negative prompt/value": "",
6
+ "txt2img/Style 1/value": "None",
7
+ "txt2img/Style 1/visible": true,
8
+ "txt2img/Style 2/value": "None",
9
+ "txt2img/Style 2/visible": true,
10
+ "txt2img/Sampling Steps/visible": true,
11
+ "txt2img/Sampling Steps/value": 20,
12
+ "txt2img/Sampling Steps/minimum": 1,
13
+ "txt2img/Sampling Steps/maximum": 150,
14
+ "txt2img/Sampling Steps/step": 1,
15
+ "txt2img/Sampling method/visible": true,
16
+ "txt2img/Sampling method/value": "Euler a",
17
+ "txt2img/Width/visible": true,
18
+ "txt2img/Width/value": 512,
19
+ "txt2img/Width/minimum": 64,
20
+ "txt2img/Width/maximum": 2048,
21
+ "txt2img/Width/step": 64,
22
+ "txt2img/Height/visible": true,
23
+ "txt2img/Height/value": 512,
24
+ "txt2img/Height/minimum": 64,
25
+ "txt2img/Height/maximum": 2048,
26
+ "txt2img/Height/step": 64,
27
+ "txt2img/Restore faces/visible": true,
28
+ "txt2img/Restore faces/value": false,
29
+ "txt2img/Tiling/visible": true,
30
+ "txt2img/Tiling/value": false,
31
+ "txt2img/Highres. fix/visible": true,
32
+ "txt2img/Highres. fix/value": false,
33
+ "txt2img/Firstpass width/visible": true,
34
+ "txt2img/Firstpass width/value": 0,
35
+ "txt2img/Firstpass width/minimum": 0,
36
+ "txt2img/Firstpass width/maximum": 1024,
37
+ "txt2img/Firstpass width/step": 64,
38
+ "txt2img/Firstpass height/visible": true,
39
+ "txt2img/Firstpass height/value": 0,
40
+ "txt2img/Firstpass height/minimum": 0,
41
+ "txt2img/Firstpass height/maximum": 1024,
42
+ "txt2img/Firstpass height/step": 64,
43
+ "txt2img/Denoising strength/visible": true,
44
+ "txt2img/Denoising strength/value": 0.7,
45
+ "txt2img/Denoising strength/minimum": 0.0,
46
+ "txt2img/Denoising strength/maximum": 1.0,
47
+ "txt2img/Denoising strength/step": 0.01,
48
+ "txt2img/Batch count/visible": true,
49
+ "txt2img/Batch count/value": 1,
50
+ "txt2img/Batch count/minimum": 1,
51
+ "txt2img/Batch count/maximum": 100,
52
+ "txt2img/Batch count/step": 1,
53
+ "txt2img/Batch size/visible": true,
54
+ "txt2img/Batch size/value": 1,
55
+ "txt2img/Batch size/minimum": 1,
56
+ "txt2img/Batch size/maximum": 8,
57
+ "txt2img/Batch size/step": 1,
58
+ "txt2img/CFG Scale/visible": true,
59
+ "txt2img/CFG Scale/value": 7.0,
60
+ "txt2img/CFG Scale/minimum": 1.0,
61
+ "txt2img/CFG Scale/maximum": 30.0,
62
+ "txt2img/CFG Scale/step": 0.5,
63
+ "txt2img/Seed/visible": true,
64
+ "txt2img/Seed/value": -1.0,
65
+ "txt2img/Extra/visible": true,
66
+ "txt2img/Extra/value": false,
67
+ "txt2img/Variation seed/visible": true,
68
+ "txt2img/Variation seed/value": -1.0,
69
+ "txt2img/Variation strength/visible": true,
70
+ "txt2img/Variation strength/value": 0.0,
71
+ "txt2img/Variation strength/minimum": 0,
72
+ "txt2img/Variation strength/maximum": 1,
73
+ "txt2img/Variation strength/step": 0.01,
74
+ "txt2img/Resize seed from width/visible": true,
75
+ "txt2img/Resize seed from width/value": 0,
76
+ "txt2img/Resize seed from width/minimum": 0,
77
+ "txt2img/Resize seed from width/maximum": 2048,
78
+ "txt2img/Resize seed from width/step": 64,
79
+ "txt2img/Resize seed from height/visible": true,
80
+ "txt2img/Resize seed from height/value": 0,
81
+ "txt2img/Resize seed from height/minimum": 0,
82
+ "txt2img/Resize seed from height/maximum": 2048,
83
+ "txt2img/Resize seed from height/step": 64,
84
+ "txt2img/Aesthetic weight/visible": true,
85
+ "txt2img/Aesthetic weight/value": 0.9,
86
+ "txt2img/Aesthetic weight/minimum": 0,
87
+ "txt2img/Aesthetic weight/maximum": 1,
88
+ "txt2img/Aesthetic weight/step": 0.01,
89
+ "txt2img/Aesthetic steps/visible": true,
90
+ "txt2img/Aesthetic steps/value": 5,
91
+ "txt2img/Aesthetic steps/minimum": 0,
92
+ "txt2img/Aesthetic steps/maximum": 50,
93
+ "txt2img/Aesthetic steps/step": 1,
94
+ "txt2img/Aesthetic learning rate/visible": true,
95
+ "txt2img/Aesthetic learning rate/value": "0.0001",
96
+ "txt2img/Slerp interpolation/visible": true,
97
+ "txt2img/Slerp interpolation/value": false,
98
+ "txt2img/Aesthetic text for imgs/visible": true,
99
+ "txt2img/Aesthetic text for imgs/value": "",
100
+ "txt2img/Slerp angle/visible": true,
101
+ "txt2img/Slerp angle/value": 0.1,
102
+ "txt2img/Slerp angle/minimum": 0,
103
+ "txt2img/Slerp angle/maximum": 1,
104
+ "txt2img/Slerp angle/step": 0.01,
105
+ "txt2img/Is negative text/visible": true,
106
+ "txt2img/Is negative text/value": false,
107
+ "txt2img/Script/value": "None",
108
+ "txt2img/Script/visible": true,
109
+ "customscript/prompt_matrix.py/txt2img/Put variable parts at start of prompt/value": false,
110
+ "customscript/prompts_from_file.py/txt2img/Show Textbox/value": false,
111
+ "customscript/xy_grid.py/txt2img/X values/value": "",
112
+ "customscript/xy_grid.py/txt2img/Y values/value": "",
113
+ "customscript/xy_grid.py/txt2img/Draw legend/value": true,
114
+ "customscript/xy_grid.py/txt2img/Include Separate Images/value": false,
115
+ "customscript/xy_grid.py/txt2img/Keep -1 for seeds/value": false,
116
+ "txt2img/Make Zip when Save?/visible": true,
117
+ "txt2img/Make Zip when Save?/value": false,
118
+ "img2img/Prompt/visible": true,
119
+ "img2img/Prompt/value": "",
120
+ "img2img/Negative prompt/visible": true,
121
+ "img2img/Negative prompt/value": "",
122
+ "img2img/Style 1/value": "None",
123
+ "img2img/Style 1/visible": true,
124
+ "img2img/Style 2/value": "None",
125
+ "img2img/Style 2/visible": true,
126
+ "img2img/Mask blur/visible": true,
127
+ "img2img/Mask blur/value": 4,
128
+ "img2img/Mask blur/minimum": 0,
129
+ "img2img/Mask blur/maximum": 64,
130
+ "img2img/Mask blur/step": 1,
131
+ "img2img/Mask mode/visible": true,
132
+ "img2img/Mask mode/value": "Draw mask",
133
+ "img2img/Masking mode/visible": true,
134
+ "img2img/Masking mode/value": "Inpaint masked",
135
+ "img2img/Masked content/visible": true,
136
+ "img2img/Masked content/value": "original",
137
+ "img2img/Inpaint at full resolution/visible": true,
138
+ "img2img/Inpaint at full resolution/value": false,
139
+ "img2img/Inpaint at full resolution padding, pixels/visible": true,
140
+ "img2img/Inpaint at full resolution padding, pixels/value": 32,
141
+ "img2img/Inpaint at full resolution padding, pixels/minimum": 0,
142
+ "img2img/Inpaint at full resolution padding, pixels/maximum": 256,
143
+ "img2img/Inpaint at full resolution padding, pixels/step": 4,
144
+ "img2img/Input directory/visible": true,
145
+ "img2img/Input directory/value": "",
146
+ "img2img/Output directory/visible": true,
147
+ "img2img/Output directory/value": "",
148
+ "img2img/Resize mode/visible": true,
149
+ "img2img/Resize mode/value": "Just resize",
150
+ "img2img/Sampling Steps/visible": true,
151
+ "img2img/Sampling Steps/value": 20,
152
+ "img2img/Sampling Steps/minimum": 1,
153
+ "img2img/Sampling Steps/maximum": 150,
154
+ "img2img/Sampling Steps/step": 1,
155
+ "img2img/Sampling method/visible": true,
156
+ "img2img/Sampling method/value": "Euler a",
157
+ "img2img/Width/visible": true,
158
+ "img2img/Width/value": 512,
159
+ "img2img/Width/minimum": 64,
160
+ "img2img/Width/maximum": 2048,
161
+ "img2img/Width/step": 64,
162
+ "img2img/Height/visible": true,
163
+ "img2img/Height/value": 512,
164
+ "img2img/Height/minimum": 64,
165
+ "img2img/Height/maximum": 2048,
166
+ "img2img/Height/step": 64,
167
+ "img2img/Restore faces/visible": true,
168
+ "img2img/Restore faces/value": false,
169
+ "img2img/Tiling/visible": true,
170
+ "img2img/Tiling/value": false,
171
+ "img2img/Batch count/visible": true,
172
+ "img2img/Batch count/value": 1,
173
+ "img2img/Batch count/minimum": 1,
174
+ "img2img/Batch count/maximum": 100,
175
+ "img2img/Batch count/step": 1,
176
+ "img2img/Batch size/visible": true,
177
+ "img2img/Batch size/value": 1,
178
+ "img2img/Batch size/minimum": 1,
179
+ "img2img/Batch size/maximum": 8,
180
+ "img2img/Batch size/step": 1,
181
+ "img2img/CFG Scale/visible": true,
182
+ "img2img/CFG Scale/value": 7.0,
183
+ "img2img/CFG Scale/minimum": 1.0,
184
+ "img2img/CFG Scale/maximum": 30.0,
185
+ "img2img/CFG Scale/step": 0.5,
186
+ "img2img/Denoising strength/visible": true,
187
+ "img2img/Denoising strength/value": 0.75,
188
+ "img2img/Denoising strength/minimum": 0.0,
189
+ "img2img/Denoising strength/maximum": 1.0,
190
+ "img2img/Denoising strength/step": 0.01,
191
+ "img2img/Seed/visible": true,
192
+ "img2img/Seed/value": -1.0,
193
+ "img2img/Extra/visible": true,
194
+ "img2img/Extra/value": false,
195
+ "img2img/Variation seed/visible": true,
196
+ "img2img/Variation seed/value": -1.0,
197
+ "img2img/Variation strength/visible": true,
198
+ "img2img/Variation strength/value": 0.0,
199
+ "img2img/Variation strength/minimum": 0,
200
+ "img2img/Variation strength/maximum": 1,
201
+ "img2img/Variation strength/step": 0.01,
202
+ "img2img/Resize seed from width/visible": true,
203
+ "img2img/Resize seed from width/value": 0,
204
+ "img2img/Resize seed from width/minimum": 0,
205
+ "img2img/Resize seed from width/maximum": 2048,
206
+ "img2img/Resize seed from width/step": 64,
207
+ "img2img/Resize seed from height/visible": true,
208
+ "img2img/Resize seed from height/value": 0,
209
+ "img2img/Resize seed from height/minimum": 0,
210
+ "img2img/Resize seed from height/maximum": 2048,
211
+ "img2img/Resize seed from height/step": 64,
212
+ "img2img/Aesthetic weight/visible": true,
213
+ "img2img/Aesthetic weight/value": 0.9,
214
+ "img2img/Aesthetic weight/minimum": 0,
215
+ "img2img/Aesthetic weight/maximum": 1,
216
+ "img2img/Aesthetic weight/step": 0.01,
217
+ "img2img/Aesthetic steps/visible": true,
218
+ "img2img/Aesthetic steps/value": 5,
219
+ "img2img/Aesthetic steps/minimum": 0,
220
+ "img2img/Aesthetic steps/maximum": 50,
221
+ "img2img/Aesthetic steps/step": 1,
222
+ "img2img/Aesthetic learning rate/visible": true,
223
+ "img2img/Aesthetic learning rate/value": "0.0001",
224
+ "img2img/Slerp interpolation/visible": true,
225
+ "img2img/Slerp interpolation/value": false,
226
+ "img2img/Aesthetic text for imgs/visible": true,
227
+ "img2img/Aesthetic text for imgs/value": "",
228
+ "img2img/Slerp angle/visible": true,
229
+ "img2img/Slerp angle/value": 0.1,
230
+ "img2img/Slerp angle/minimum": 0,
231
+ "img2img/Slerp angle/maximum": 1,
232
+ "img2img/Slerp angle/step": 0.01,
233
+ "img2img/Is negative text/visible": true,
234
+ "img2img/Is negative text/value": false,
235
+ "img2img/Script/value": "None",
236
+ "img2img/Script/visible": true,
237
+ "customscript/img2imgalt.py/img2img/Override `Sampling method` to Euler?(this method is built for it)/value": true,
238
+ "customscript/img2imgalt.py/img2img/Override `prompt` to the same value as `original prompt`?(and `negative prompt`)/value": true,
239
+ "customscript/img2imgalt.py/img2img/Original prompt/value": "",
240
+ "customscript/img2imgalt.py/img2img/Original negative prompt/value": "",
241
+ "customscript/img2imgalt.py/img2img/Override `Sampling Steps` to the same value as `Decode steps`?/value": true,
242
+ "customscript/img2imgalt.py/img2img/Decode steps/value": 50,
243
+ "customscript/img2imgalt.py/img2img/Decode steps/minimum": 1,
244
+ "customscript/img2imgalt.py/img2img/Decode steps/maximum": 150,
245
+ "customscript/img2imgalt.py/img2img/Decode steps/step": 1,
246
+ "customscript/img2imgalt.py/img2img/Override `Denoising strength` to 1?/value": true,
247
+ "customscript/img2imgalt.py/img2img/Decode CFG scale/value": 1.0,
248
+ "customscript/img2imgalt.py/img2img/Decode CFG scale/minimum": 0.0,
249
+ "customscript/img2imgalt.py/img2img/Decode CFG scale/maximum": 15.0,
250
+ "customscript/img2imgalt.py/img2img/Decode CFG scale/step": 0.1,
251
+ "customscript/img2imgalt.py/img2img/Randomness/value": 0.0,
252
+ "customscript/img2imgalt.py/img2img/Randomness/minimum": 0.0,
253
+ "customscript/img2imgalt.py/img2img/Randomness/maximum": 1.0,
254
+ "customscript/img2imgalt.py/img2img/Randomness/step": 0.01,
255
+ "customscript/img2imgalt.py/img2img/Sigma adjustment for finding noise for image/value": false,
256
+ "customscript/loopback.py/img2img/Loops/value": 4,
257
+ "customscript/loopback.py/img2img/Loops/minimum": 1,
258
+ "customscript/loopback.py/img2img/Loops/maximum": 32,
259
+ "customscript/loopback.py/img2img/Loops/step": 1,
260
+ "customscript/loopback.py/img2img/Denoising strength change factor/value": 1,
261
+ "customscript/loopback.py/img2img/Denoising strength change factor/minimum": 0.9,
262
+ "customscript/loopback.py/img2img/Denoising strength change factor/maximum": 1.1,
263
+ "customscript/loopback.py/img2img/Denoising strength change factor/step": 0.01,
264
+ "customscript/outpainting_mk_2.py/img2img/Pixels to expand/value": 128,
265
+ "customscript/outpainting_mk_2.py/img2img/Pixels to expand/minimum": 8,
266
+ "customscript/outpainting_mk_2.py/img2img/Pixels to expand/maximum": 256,
267
+ "customscript/outpainting_mk_2.py/img2img/Pixels to expand/step": 8,
268
+ "customscript/outpainting_mk_2.py/img2img/Mask blur/value": 8,
269
+ "customscript/outpainting_mk_2.py/img2img/Mask blur/minimum": 0,
270
+ "customscript/outpainting_mk_2.py/img2img/Mask blur/maximum": 64,
271
+ "customscript/outpainting_mk_2.py/img2img/Mask blur/step": 1,
272
+ "customscript/outpainting_mk_2.py/img2img/Fall-off exponent (lower=higher detail)/value": 1.0,
273
+ "customscript/outpainting_mk_2.py/img2img/Fall-off exponent (lower=higher detail)/minimum": 0.0,
274
+ "customscript/outpainting_mk_2.py/img2img/Fall-off exponent (lower=higher detail)/maximum": 4.0,
275
+ "customscript/outpainting_mk_2.py/img2img/Fall-off exponent (lower=higher detail)/step": 0.01,
276
+ "customscript/outpainting_mk_2.py/img2img/Color variation/value": 0.05,
277
+ "customscript/outpainting_mk_2.py/img2img/Color variation/minimum": 0.0,
278
+ "customscript/outpainting_mk_2.py/img2img/Color variation/maximum": 1.0,
279
+ "customscript/outpainting_mk_2.py/img2img/Color variation/step": 0.01,
280
+ "customscript/poor_mans_outpainting.py/img2img/Pixels to expand/value": 128,
281
+ "customscript/poor_mans_outpainting.py/img2img/Pixels to expand/minimum": 8,
282
+ "customscript/poor_mans_outpainting.py/img2img/Pixels to expand/maximum": 256,
283
+ "customscript/poor_mans_outpainting.py/img2img/Pixels to expand/step": 8,
284
+ "customscript/poor_mans_outpainting.py/img2img/Mask blur/value": 4,
285
+ "customscript/poor_mans_outpainting.py/img2img/Mask blur/minimum": 0,
286
+ "customscript/poor_mans_outpainting.py/img2img/Mask blur/maximum": 64,
287
+ "customscript/poor_mans_outpainting.py/img2img/Mask blur/step": 1,
288
+ "customscript/poor_mans_outpainting.py/img2img/Masked content/value": "fill",
289
+ "customscript/prompt_matrix.py/img2img/Put variable parts at start of prompt/value": false,
290
+ "customscript/prompts_from_file.py/img2img/Show Textbox/value": false,
291
+ "customscript/sd_upscale.py/img2img/Tile overlap/value": 64,
292
+ "customscript/sd_upscale.py/img2img/Tile overlap/minimum": 0,
293
+ "customscript/sd_upscale.py/img2img/Tile overlap/maximum": 256,
294
+ "customscript/sd_upscale.py/img2img/Tile overlap/step": 16,
295
+ "customscript/sd_upscale.py/img2img/Upscaler/value": "None",
296
+ "customscript/xy_grid.py/img2img/X values/value": "",
297
+ "customscript/xy_grid.py/img2img/Y values/value": "",
298
+ "customscript/xy_grid.py/img2img/Draw legend/value": true,
299
+ "customscript/xy_grid.py/img2img/Include Separate Images/value": false,
300
+ "customscript/xy_grid.py/img2img/Keep -1 for seeds/value": false,
301
+ "img2img/Make Zip when Save?/visible": true,
302
+ "img2img/Make Zip when Save?/value": false,
303
+ "extras/Input directory/visible": true,
304
+ "extras/Input directory/value": "",
305
+ "extras/Output directory/visible": true,
306
+ "extras/Output directory/value": "",
307
+ "extras/Show result images/visible": true,
308
+ "extras/Show result images/value": true,
309
+ "extras/Resize/visible": true,
310
+ "extras/Resize/value": 2,
311
+ "extras/Resize/minimum": 1.0,
312
+ "extras/Resize/maximum": 4.0,
313
+ "extras/Resize/step": 0.05,
314
+ "extras/Width/visible": true,
315
+ "extras/Width/value": 512,
316
+ "extras/Height/visible": true,
317
+ "extras/Height/value": 512,
318
+ "extras/Crop to fit/visible": true,
319
+ "extras/Crop to fit/value": true,
320
+ "extras/Upscaler 1/visible": true,
321
+ "extras/Upscaler 1/value": "None",
322
+ "extras/Upscaler 2/visible": true,
323
+ "extras/Upscaler 2/value": "None",
324
+ "extras/Upscaler 2 visibility/visible": true,
325
+ "extras/Upscaler 2 visibility/value": 1,
326
+ "extras/Upscaler 2 visibility/minimum": 0.0,
327
+ "extras/Upscaler 2 visibility/maximum": 1.0,
328
+ "extras/Upscaler 2 visibility/step": 0.001,
329
+ "extras/GFPGAN visibility/visible": true,
330
+ "extras/GFPGAN visibility/value": 0,
331
+ "extras/GFPGAN visibility/minimum": 0.0,
332
+ "extras/GFPGAN visibility/maximum": 1.0,
333
+ "extras/GFPGAN visibility/step": 0.001,
334
+ "extras/CodeFormer visibility/visible": true,
335
+ "extras/CodeFormer visibility/value": 0,
336
+ "extras/CodeFormer visibility/minimum": 0.0,
337
+ "extras/CodeFormer visibility/maximum": 1.0,
338
+ "extras/CodeFormer visibility/step": 0.001,
339
+ "extras/CodeFormer weight (0 = maximum effect, 1 = minimum effect)/visible": true,
340
+ "extras/CodeFormer weight (0 = maximum effect, 1 = minimum effect)/value": 0,
341
+ "extras/CodeFormer weight (0 = maximum effect, 1 = minimum effect)/minimum": 0.0,
342
+ "extras/CodeFormer weight (0 = maximum effect, 1 = minimum effect)/maximum": 1.0,
343
+ "extras/CodeFormer weight (0 = maximum effect, 1 = minimum effect)/step": 0.001,
344
+ "modelmerger/Custom Name (Optional)/visible": true,
345
+ "modelmerger/Custom Name (Optional)/value": "",
346
+ "modelmerger/Multiplier (M) - set to 0 to get model A/visible": true,
347
+ "modelmerger/Multiplier (M) - set to 0 to get model A/value": 0.3,
348
+ "modelmerger/Multiplier (M) - set to 0 to get model A/minimum": 0.0,
349
+ "modelmerger/Multiplier (M) - set to 0 to get model A/maximum": 1.0,
350
+ "modelmerger/Multiplier (M) - set to 0 to get model A/step": 0.05,
351
+ "modelmerger/Interpolation Method/visible": true,
352
+ "modelmerger/Interpolation Method/value": "Weighted sum",
353
+ "modelmerger/Save as float16/visible": true,
354
+ "modelmerger/Save as float16/value": false
355
+ }
webui-user.bat ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ set PYTHON=
4
+ set GIT=
5
+ set VENV_DIR=
6
+ set COMMANDLINE_ARGS=
7
+
8
+ call webui.bat
webui-user.sh ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #########################################################
3
+ # Uncomment and change the variables below to your need:#
4
+ #########################################################
5
+
6
+ # Install directory without trailing slash
7
+ #install_dir="/home/$(whoami)"
8
+
9
+ # Name of the subdirectory
10
+ #clone_dir="stable-diffusion-webui"
11
+
12
+ # Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention"
13
+ export COMMANDLINE_ARGS=""
14
+
15
+ # python3 executable
16
+ #python_cmd="python3"
17
+
18
+ # git executable
19
+ #export GIT="git"
20
+
21
+ # python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
22
+ #venv_dir="venv"
23
+
24
+ # script to launch to start the app
25
+ #export LAUNCH_SCRIPT="launch.py"
26
+
27
+ # install command for torch
28
+ #export TORCH_COMMAND="pip install torch==1.12.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113"
29
+
30
+ # Requirements file to use for stable-diffusion-webui
31
+ #export REQS_FILE="requirements_versions.txt"
32
+
33
+ # Fixed git repos
34
+ #export K_DIFFUSION_PACKAGE=""
35
+ #export GFPGAN_PACKAGE=""
36
+
37
+ # Fixed git commits
38
+ #export STABLE_DIFFUSION_COMMIT_HASH=""
39
+ #export TAMING_TRANSFORMERS_COMMIT_HASH=""
40
+ #export CODEFORMER_COMMIT_HASH=""
41
+ #export BLIP_COMMIT_HASH=""
42
+
43
+ ###########################################
webui.bat ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+
3
+ if not defined PYTHON (set PYTHON=python)
4
+ if not defined VENV_DIR (set VENV_DIR=venv)
5
+
6
+ set ERROR_REPORTING=FALSE
7
+
8
+ mkdir tmp 2>NUL
9
+
10
+ %PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt
11
+ if %ERRORLEVEL% == 0 goto :start_venv
12
+ echo Couldn't launch python
13
+ goto :show_stdout_stderr
14
+
15
+ :start_venv
16
+ if [%VENV_DIR%] == [-] goto :skip_venv
17
+
18
+ dir %VENV_DIR%\Scripts\Python.exe >tmp/stdout.txt 2>tmp/stderr.txt
19
+ if %ERRORLEVEL% == 0 goto :activate_venv
20
+
21
+ for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"
22
+ echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%
23
+ %PYTHON_FULLNAME% -m venv %VENV_DIR% >tmp/stdout.txt 2>tmp/stderr.txt
24
+ if %ERRORLEVEL% == 0 goto :activate_venv
25
+ echo Unable to create venv in directory %VENV_DIR%
26
+ goto :show_stdout_stderr
27
+
28
+ :activate_venv
29
+ set PYTHON="%~dp0%VENV_DIR%\Scripts\Python.exe"
30
+ echo venv %PYTHON%
31
+ goto :launch
32
+
33
+ :skip_venv
34
+
35
+ :launch
36
+ %PYTHON% launch.py %*
37
+ pause
38
+ exit /b
39
+
40
+ :show_stdout_stderr
41
+
42
+ echo.
43
+ echo exit code: %errorlevel%
44
+
45
+ for /f %%i in ("tmp\stdout.txt") do set size=%%~zi
46
+ if %size% equ 0 goto :show_stderr
47
+ echo.
48
+ echo stdout:
49
+ type tmp\stdout.txt
50
+
51
+ :show_stderr
52
+ for /f %%i in ("tmp\stderr.txt") do set size=%%~zi
53
+ if %size% equ 0 goto :show_stderr
54
+ echo.
55
+ echo stderr:
56
+ type tmp\stderr.txt
57
+
58
+ :endofscript
59
+
60
+ echo.
61
+ echo Launch unsuccessful. Exiting.
62
+ pause
webui.py ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import threading
3
+ import time
4
+ import importlib
5
+ import signal
6
+ import threading
7
+ from fastapi import FastAPI
8
+ from fastapi.middleware.gzip import GZipMiddleware
9
+
10
+ from modules.paths import script_path
11
+
12
+ from modules import devices, sd_samplers
13
+ import modules.codeformer_model as codeformer
14
+ import modules.extras
15
+ import modules.face_restoration
16
+ import modules.gfpgan_model as gfpgan
17
+ import modules.img2img
18
+
19
+ import modules.lowvram
20
+ import modules.paths
21
+ import modules.scripts
22
+ import modules.sd_hijack
23
+ import modules.sd_models
24
+ import modules.shared as shared
25
+ import modules.txt2img
26
+
27
+ import modules.ui
28
+ from modules import devices
29
+ from modules import modelloader
30
+ from modules.paths import script_path
31
+ from modules.shared import cmd_opts
32
+ import modules.hypernetworks.hypernetwork
33
+
34
+ queue_lock = threading.Lock()
35
+
36
+
37
+ def wrap_queued_call(func):
38
+ def f(*args, **kwargs):
39
+ with queue_lock:
40
+ res = func(*args, **kwargs)
41
+
42
+ return res
43
+
44
+ return f
45
+
46
+
47
+ def wrap_gradio_gpu_call(func, extra_outputs=None):
48
+ def f(*args, **kwargs):
49
+ devices.torch_gc()
50
+
51
+ shared.state.sampling_step = 0
52
+ shared.state.job_count = -1
53
+ shared.state.job_no = 0
54
+ shared.state.job_timestamp = shared.state.get_job_timestamp()
55
+ shared.state.current_latent = None
56
+ shared.state.current_image = None
57
+ shared.state.current_image_sampling_step = 0
58
+ shared.state.skipped = False
59
+ shared.state.interrupted = False
60
+ shared.state.textinfo = None
61
+
62
+ with queue_lock:
63
+ res = func(*args, **kwargs)
64
+
65
+ shared.state.job = ""
66
+ shared.state.job_count = 0
67
+
68
+ devices.torch_gc()
69
+
70
+ return res
71
+
72
+ return modules.ui.wrap_gradio_call(f, extra_outputs=extra_outputs)
73
+
74
+ def initialize():
75
+ modelloader.cleanup_models()
76
+ modules.sd_models.setup_model()
77
+ codeformer.setup_model(cmd_opts.codeformer_models_path)
78
+ gfpgan.setup_model(cmd_opts.gfpgan_models_path)
79
+ shared.face_restorers.append(modules.face_restoration.FaceRestoration())
80
+ modelloader.load_upscalers()
81
+
82
+ modules.scripts.load_scripts(os.path.join(script_path, "scripts"))
83
+
84
+ shared.sd_model = modules.sd_models.load_model()
85
+ shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights(shared.sd_model)))
86
+ shared.opts.onchange("sd_hypernetwork", wrap_queued_call(lambda: modules.hypernetworks.hypernetwork.load_hypernetwork(shared.opts.sd_hypernetwork)))
87
+ shared.opts.onchange("sd_hypernetwork_strength", modules.hypernetworks.hypernetwork.apply_strength)
88
+
89
+ # make the program just exit at ctrl+c without waiting for anything
90
+ def sigint_handler(sig, frame):
91
+ print(f'Interrupted with signal {sig} in {frame}')
92
+ os._exit(0)
93
+
94
+ signal.signal(signal.SIGINT, sigint_handler)
95
+
96
+
97
+ def create_api(app):
98
+ from modules.api.api import Api
99
+ api = Api(app, queue_lock)
100
+ return api
101
+
102
+ def wait_on_server(demo=None):
103
+ while 1:
104
+ time.sleep(0.5)
105
+ if demo and getattr(demo, 'do_restart', False):
106
+ time.sleep(0.5)
107
+ demo.close()
108
+ time.sleep(0.5)
109
+ break
110
+
111
+ def api_only():
112
+ initialize()
113
+
114
+ app = FastAPI()
115
+ app.add_middleware(GZipMiddleware, minimum_size=1000)
116
+ api = create_api(app)
117
+
118
+ api.launch(server_name="0.0.0.0" if cmd_opts.listen else "127.0.0.1", port=cmd_opts.port if cmd_opts.port else 7861)
119
+
120
+
121
+ def webui():
122
+ launch_api = cmd_opts.api
123
+ initialize()
124
+
125
+ while 1:
126
+ demo = modules.ui.create_ui(wrap_gradio_gpu_call=wrap_gradio_gpu_call)
127
+
128
+ app, local_url, share_url = demo.launch(
129
+ share=True,
130
+ server_name="0.0.0.0" if cmd_opts.listen else None,
131
+ server_port=cmd_opts.port,
132
+ debug=cmd_opts.gradio_debug,
133
+ auth=[tuple(cred.split(':')) for cred in cmd_opts.gradio_auth.strip('"').split(',')] if cmd_opts.gradio_auth else None,
134
+ inbrowser=cmd_opts.autolaunch,
135
+ prevent_thread_lock=True
136
+ )
137
+
138
+ app.add_middleware(GZipMiddleware, minimum_size=1000)
139
+
140
+ if (launch_api):
141
+ create_api(app)
142
+
143
+ wait_on_server(demo)
144
+
145
+ sd_samplers.set_samplers()
146
+
147
+ print('Reloading Custom Scripts')
148
+ modules.scripts.reload_scripts(os.path.join(script_path, "scripts"))
149
+ print('Reloading modules: modules.ui')
150
+ importlib.reload(modules.ui)
151
+ print('Refreshing Model List')
152
+ modules.sd_models.list_models()
153
+ print('Restarting Gradio')
154
+
155
+
156
+
157
+ task = []
158
+ if __name__ == "__main__":
159
+ if cmd_opts.nowebui:
160
+ api_only()
161
+ else:
162
+ webui()
webui.sh ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #################################################
3
+ # Please do not make any changes to this file, #
4
+ # change the variables in webui-user.sh instead #
5
+ #################################################
6
+ # Read variables from webui-user.sh
7
+ # shellcheck source=/dev/null
8
+ if [[ -f webui-user.sh ]]
9
+ then
10
+ source ./webui-user.sh
11
+ fi
12
+
13
+ # Set defaults
14
+ # Install directory without trailing slash
15
+ if [[ -z "${install_dir}" ]]
16
+ then
17
+ install_dir="/home/$(whoami)"
18
+ fi
19
+
20
+ # Name of the subdirectory (defaults to stable-diffusion-webui)
21
+ if [[ -z "${clone_dir}" ]]
22
+ then
23
+ clone_dir="stable-diffusion-webui"
24
+ fi
25
+
26
+ # python3 executable
27
+ if [[ -z "${python_cmd}" ]]
28
+ then
29
+ python_cmd="python3"
30
+ fi
31
+
32
+ # git executable
33
+ if [[ -z "${GIT}" ]]
34
+ then
35
+ export GIT="git"
36
+ fi
37
+
38
+ # python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
39
+ if [[ -z "${venv_dir}" ]]
40
+ then
41
+ venv_dir="venv"
42
+ fi
43
+
44
+ if [[ -z "${LAUNCH_SCRIPT}" ]]
45
+ then
46
+ LAUNCH_SCRIPT="launch.py"
47
+ fi
48
+
49
+ # Disable sentry logging
50
+ export ERROR_REPORTING=FALSE
51
+
52
+ # Do not reinstall existing pip packages on Debian/Ubuntu
53
+ export PIP_IGNORE_INSTALLED=0
54
+
55
+ # Pretty print
56
+ delimiter="################################################################"
57
+
58
+ printf "\n%s\n" "${delimiter}"
59
+ printf "\e[1m\e[32mInstall script for stable-diffusion + Web UI\n"
60
+ printf "\e[1m\e[34mTested on Debian 11 (Bullseye)\e[0m"
61
+ printf "\n%s\n" "${delimiter}"
62
+
63
+ # Do not run as root
64
+ if [[ $(id -u) -eq 0 ]]
65
+ then
66
+ printf "\n%s\n" "${delimiter}"
67
+ printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"
68
+ printf "\n%s\n" "${delimiter}"
69
+ exit 1
70
+ else
71
+ printf "\n%s\n" "${delimiter}"
72
+ printf "Running on \e[1m\e[32m%s\e[0m user" "$(whoami)"
73
+ printf "\n%s\n" "${delimiter}"
74
+ fi
75
+
76
+ if [[ -d .git ]]
77
+ then
78
+ printf "\n%s\n" "${delimiter}"
79
+ printf "Repo already cloned, using it as install directory"
80
+ printf "\n%s\n" "${delimiter}"
81
+ install_dir="${PWD}/../"
82
+ clone_dir="${PWD##*/}"
83
+ fi
84
+
85
+ # Check prerequisites
86
+ for preq in "${GIT}" "${python_cmd}"
87
+ do
88
+ if ! hash "${preq}" &>/dev/null
89
+ then
90
+ printf "\n%s\n" "${delimiter}"
91
+ printf "\e[1m\e[31mERROR: %s is not installed, aborting...\e[0m" "${preq}"
92
+ printf "\n%s\n" "${delimiter}"
93
+ exit 1
94
+ fi
95
+ done
96
+
97
+ if ! "${python_cmd}" -c "import venv" &>/dev/null
98
+ then
99
+ printf "\n%s\n" "${delimiter}"
100
+ printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m"
101
+ printf "\n%s\n" "${delimiter}"
102
+ exit 1
103
+ fi
104
+
105
+ printf "\n%s\n" "${delimiter}"
106
+ printf "Clone or update stable-diffusion-webui"
107
+ printf "\n%s\n" "${delimiter}"
108
+ cd "${install_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/, aborting...\e[0m" "${install_dir}"; exit 1; }
109
+ if [[ -d "${clone_dir}" ]]
110
+ then
111
+ cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
112
+ "${GIT}" pull
113
+ else
114
+ "${GIT}" clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "${clone_dir}"
115
+ cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
116
+ fi
117
+
118
+ printf "\n%s\n" "${delimiter}"
119
+ printf "Create and activate python venv"
120
+ printf "\n%s\n" "${delimiter}"
121
+ cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
122
+ if [[ ! -d "${venv_dir}" ]]
123
+ then
124
+ "${python_cmd}" -m venv "${venv_dir}"
125
+ first_launch=1
126
+ fi
127
+ # shellcheck source=/dev/null
128
+ if [[ -f "${venv_dir}"/bin/activate ]]
129
+ then
130
+ source "${venv_dir}"/bin/activate
131
+ else
132
+ printf "\n%s\n" "${delimiter}"
133
+ printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m"
134
+ printf "\n%s\n" "${delimiter}"
135
+ exit 1
136
+ fi
137
+
138
+ printf "\n%s\n" "${delimiter}"
139
+ printf "Launching launch.py..."
140
+ printf "\n%s\n" "${delimiter}"
141
+ "${python_cmd}" "${LAUNCH_SCRIPT}" "$@"