Spaces:
Runtime error
Runtime error
Upload 25 files
#3
by
PonyC
- opened
- .eslintignore +4 -0
- .eslintrc.js +88 -0
- .git-blame-ignore-revs +2 -0
- .gitignore +39 -0
- .pylintrc +3 -0
- CHANGELOG.md +200 -0
- CODEOWNERS +12 -0
- LICENSE.txt +663 -0
- README.md +166 -17
- environment-wsl2.yaml +11 -0
- launch.py +38 -0
- package.json +11 -0
- pyproject.toml +35 -0
- requirements-test.txt +3 -0
- requirements.txt +32 -0
- requirements_versions.txt +29 -0
- screenshot.png +0 -0
- script.js +112 -0
- style.css +926 -0
- webui-macos-env.sh +19 -0
- webui-user.bat +8 -0
- webui-user.sh +49 -0
- webui.bat +85 -0
- webui.py +478 -0
- webui.sh +216 -0
.eslintignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
extensions
|
2 |
+
extensions-disabled
|
3 |
+
repositories
|
4 |
+
venv
|
.eslintrc.js
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* global module */
|
2 |
+
module.exports = {
|
3 |
+
env: {
|
4 |
+
browser: true,
|
5 |
+
es2021: true,
|
6 |
+
},
|
7 |
+
extends: "eslint:recommended",
|
8 |
+
parserOptions: {
|
9 |
+
ecmaVersion: "latest",
|
10 |
+
},
|
11 |
+
rules: {
|
12 |
+
"arrow-spacing": "error",
|
13 |
+
"block-spacing": "error",
|
14 |
+
"brace-style": "error",
|
15 |
+
"comma-dangle": ["error", "only-multiline"],
|
16 |
+
"comma-spacing": "error",
|
17 |
+
"comma-style": ["error", "last"],
|
18 |
+
"curly": ["error", "multi-line", "consistent"],
|
19 |
+
"eol-last": "error",
|
20 |
+
"func-call-spacing": "error",
|
21 |
+
"function-call-argument-newline": ["error", "consistent"],
|
22 |
+
"function-paren-newline": ["error", "consistent"],
|
23 |
+
"indent": ["error", 4],
|
24 |
+
"key-spacing": "error",
|
25 |
+
"keyword-spacing": "error",
|
26 |
+
"linebreak-style": ["error", "unix"],
|
27 |
+
"no-extra-semi": "error",
|
28 |
+
"no-mixed-spaces-and-tabs": "error",
|
29 |
+
"no-multi-spaces": "error",
|
30 |
+
"no-redeclare": ["error", {builtinGlobals: false}],
|
31 |
+
"no-trailing-spaces": "error",
|
32 |
+
"no-unused-vars": "off",
|
33 |
+
"no-whitespace-before-property": "error",
|
34 |
+
"object-curly-newline": ["error", {consistent: true, multiline: true}],
|
35 |
+
"object-curly-spacing": ["error", "never"],
|
36 |
+
"operator-linebreak": ["error", "after"],
|
37 |
+
"quote-props": ["error", "consistent-as-needed"],
|
38 |
+
"semi": ["error", "always"],
|
39 |
+
"semi-spacing": "error",
|
40 |
+
"semi-style": ["error", "last"],
|
41 |
+
"space-before-blocks": "error",
|
42 |
+
"space-before-function-paren": ["error", "never"],
|
43 |
+
"space-in-parens": ["error", "never"],
|
44 |
+
"space-infix-ops": "error",
|
45 |
+
"space-unary-ops": "error",
|
46 |
+
"switch-colon-spacing": "error",
|
47 |
+
"template-curly-spacing": ["error", "never"],
|
48 |
+
"unicode-bom": "error",
|
49 |
+
},
|
50 |
+
globals: {
|
51 |
+
//script.js
|
52 |
+
gradioApp: "readonly",
|
53 |
+
onUiLoaded: "readonly",
|
54 |
+
onUiUpdate: "readonly",
|
55 |
+
onOptionsChanged: "readonly",
|
56 |
+
uiCurrentTab: "writable",
|
57 |
+
uiElementIsVisible: "readonly",
|
58 |
+
uiElementInSight: "readonly",
|
59 |
+
executeCallbacks: "readonly",
|
60 |
+
//ui.js
|
61 |
+
opts: "writable",
|
62 |
+
all_gallery_buttons: "readonly",
|
63 |
+
selected_gallery_button: "readonly",
|
64 |
+
selected_gallery_index: "readonly",
|
65 |
+
switch_to_txt2img: "readonly",
|
66 |
+
switch_to_img2img_tab: "readonly",
|
67 |
+
switch_to_img2img: "readonly",
|
68 |
+
switch_to_sketch: "readonly",
|
69 |
+
switch_to_inpaint: "readonly",
|
70 |
+
switch_to_inpaint_sketch: "readonly",
|
71 |
+
switch_to_extras: "readonly",
|
72 |
+
get_tab_index: "readonly",
|
73 |
+
create_submit_args: "readonly",
|
74 |
+
restart_reload: "readonly",
|
75 |
+
updateInput: "readonly",
|
76 |
+
//extraNetworks.js
|
77 |
+
requestGet: "readonly",
|
78 |
+
popup: "readonly",
|
79 |
+
// from python
|
80 |
+
localization: "readonly",
|
81 |
+
// progrssbar.js
|
82 |
+
randomId: "readonly",
|
83 |
+
requestProgress: "readonly",
|
84 |
+
// imageviewer.js
|
85 |
+
modalPrevImage: "readonly",
|
86 |
+
modalNextImage: "readonly",
|
87 |
+
}
|
88 |
+
};
|
.git-blame-ignore-revs
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
# Apply ESlint
|
2 |
+
9c54b78d9dde5601e916f308d9a9d6953ec39430
|
.gitignore
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__
|
2 |
+
*.ckpt
|
3 |
+
*.safetensors
|
4 |
+
*.pth
|
5 |
+
/ESRGAN/*
|
6 |
+
/SwinIR/*
|
7 |
+
/repositories
|
8 |
+
/venv
|
9 |
+
/tmp
|
10 |
+
/model.ckpt
|
11 |
+
/models/**/*
|
12 |
+
/GFPGANv1.3.pth
|
13 |
+
/gfpgan/weights/*.pth
|
14 |
+
/ui-config.json
|
15 |
+
/outputs
|
16 |
+
/config.json
|
17 |
+
/log
|
18 |
+
/webui.settings.bat
|
19 |
+
/embeddings
|
20 |
+
/styles.csv
|
21 |
+
/params.txt
|
22 |
+
/styles.csv.bak
|
23 |
+
/webui-user.bat
|
24 |
+
/webui-user.sh
|
25 |
+
/interrogate
|
26 |
+
/user.css
|
27 |
+
/.idea
|
28 |
+
notification.mp3
|
29 |
+
/SwinIR
|
30 |
+
/textual_inversion
|
31 |
+
.vscode
|
32 |
+
/extensions
|
33 |
+
/test/stdout.txt
|
34 |
+
/test/stderr.txt
|
35 |
+
/cache.json*
|
36 |
+
/config_states/
|
37 |
+
/node_modules
|
38 |
+
/package-lock.json
|
39 |
+
/.coverage*
|
.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
|
CHANGELOG.md
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## 1.3.2
|
2 |
+
|
3 |
+
### Bug Fixes:
|
4 |
+
* fix files served out of tmp directory even if they are saved to disk
|
5 |
+
* fix postprocessing overwriting parameters
|
6 |
+
|
7 |
+
## 1.3.1
|
8 |
+
|
9 |
+
### Features:
|
10 |
+
* revert default cross attention optimization to Doggettx
|
11 |
+
|
12 |
+
### Bug Fixes:
|
13 |
+
* fix bug: LoRA don't apply on dropdown list sd_lora
|
14 |
+
* fix png info always added even if setting is not enabled
|
15 |
+
* fix some fields not applying in xyz plot
|
16 |
+
* fix "hires. fix" prompt sharing same labels with txt2img_prompt
|
17 |
+
* fix lora hashes not being added properly to infotex if there is only one lora
|
18 |
+
* fix --use-cpu failing to work properly at startup
|
19 |
+
* make --disable-opt-split-attention command line option work again
|
20 |
+
|
21 |
+
## 1.3.0
|
22 |
+
|
23 |
+
### Features:
|
24 |
+
* add UI to edit defaults
|
25 |
+
* token merging (via dbolya/tomesd)
|
26 |
+
* settings tab rework: add a lot of additional explanations and links
|
27 |
+
* load extensions' Git metadata in parallel to loading the main program to save a ton of time during startup
|
28 |
+
* update extensions table: show branch, show date in separate column, and show version from tags if available
|
29 |
+
* TAESD - another option for cheap live previews
|
30 |
+
* allow choosing sampler and prompts for second pass of hires fix - hidden by default, enabled in settings
|
31 |
+
* calculate hashes for Lora
|
32 |
+
* add lora hashes to infotext
|
33 |
+
* when pasting infotext, use infotext's lora hashes to find local loras for `<lora:xxx:1>` entries whose hashes match loras the user has
|
34 |
+
* select cross attention optimization from UI
|
35 |
+
|
36 |
+
### Minor:
|
37 |
+
* bump Gradio to 3.31.0
|
38 |
+
* bump PyTorch to 2.0.1 for macOS and Linux AMD
|
39 |
+
* allow setting defaults for elements in extensions' tabs
|
40 |
+
* allow selecting file type for live previews
|
41 |
+
* show "Loading..." for extra networks when displaying for the first time
|
42 |
+
* suppress ENSD infotext for samplers that don't use it
|
43 |
+
* clientside optimizations
|
44 |
+
* add options to show/hide hidden files and dirs in extra networks, and to not list models/files in hidden directories
|
45 |
+
* allow whitespace in styles.csv
|
46 |
+
* add option to reorder tabs
|
47 |
+
* move some functionality (swap resolution and set seed to -1) to client
|
48 |
+
* option to specify editor height for img2img
|
49 |
+
* button to copy image resolution into img2img width/height sliders
|
50 |
+
* switch from pyngrok to ngrok-py
|
51 |
+
* lazy-load images in extra networks UI
|
52 |
+
* set "Navigate image viewer with gamepad" option to false by default, by request
|
53 |
+
* change upscalers to download models into user-specified directory (from commandline args) rather than the default models/<...>
|
54 |
+
* allow hiding buttons in ui-config.json
|
55 |
+
|
56 |
+
### Extensions:
|
57 |
+
* add /sdapi/v1/script-info api
|
58 |
+
* use Ruff to lint Python code
|
59 |
+
* use ESlint to lint Javascript code
|
60 |
+
* add/modify CFG callbacks for Self-Attention Guidance extension
|
61 |
+
* add command and endpoint for graceful server stopping
|
62 |
+
* add some locals (prompts/seeds/etc) from processing function into the Processing class as fields
|
63 |
+
* rework quoting for infotext items that have commas in them to use JSON (should be backwards compatible except for cases where it didn't work previously)
|
64 |
+
* add /sdapi/v1/refresh-loras api checkpoint post request
|
65 |
+
* tests overhaul
|
66 |
+
|
67 |
+
### Bug Fixes:
|
68 |
+
* fix an issue preventing the program from starting if the user specifies a bad Gradio theme
|
69 |
+
* fix broken prompts from file script
|
70 |
+
* fix symlink scanning for extra networks
|
71 |
+
* fix --data-dir ignored when launching via webui-user.bat COMMANDLINE_ARGS
|
72 |
+
* allow web UI to be ran fully offline
|
73 |
+
* fix inability to run with --freeze-settings
|
74 |
+
* fix inability to merge checkpoint without adding metadata
|
75 |
+
* fix extra networks' save preview image not adding infotext for jpeg/webm
|
76 |
+
* remove blinking effect from text in hires fix and scale resolution preview
|
77 |
+
* make links to `http://<...>.git` extensions work in the extension tab
|
78 |
+
* fix bug with webui hanging at startup due to hanging git process
|
79 |
+
|
80 |
+
|
81 |
+
## 1.2.1
|
82 |
+
|
83 |
+
### Features:
|
84 |
+
* add an option to always refer to LoRA by filenames
|
85 |
+
|
86 |
+
### Bug Fixes:
|
87 |
+
* never refer to LoRA by an alias if multiple LoRAs have same alias or the alias is called none
|
88 |
+
* fix upscalers disappearing after the user reloads UI
|
89 |
+
* allow bf16 in safe unpickler (resolves problems with loading some LoRAs)
|
90 |
+
* allow web UI to be ran fully offline
|
91 |
+
* fix localizations not working
|
92 |
+
* fix error for LoRAs: `'LatentDiffusion' object has no attribute 'lora_layer_mapping'`
|
93 |
+
|
94 |
+
## 1.2.0
|
95 |
+
|
96 |
+
### Features:
|
97 |
+
* do not wait for Stable Diffusion model to load at startup
|
98 |
+
* add filename patterns: `[denoising]`
|
99 |
+
* directory hiding for extra networks: dirs starting with `.` will hide their cards on extra network tabs unless specifically searched for
|
100 |
+
* LoRA: for the `<...>` text in prompt, use name of LoRA that is in the metdata of the file, if present, instead of filename (both can be used to activate LoRA)
|
101 |
+
* LoRA: read infotext params from kohya-ss's extension parameters if they are present and if his extension is not active
|
102 |
+
* LoRA: fix some LoRAs not working (ones that have 3x3 convolution layer)
|
103 |
+
* LoRA: add an option to use old method of applying LoRAs (producing same results as with kohya-ss)
|
104 |
+
* add version to infotext, footer and console output when starting
|
105 |
+
* add links to wiki for filename pattern settings
|
106 |
+
* add extended info for quicksettings setting and use multiselect input instead of a text field
|
107 |
+
|
108 |
+
### Minor:
|
109 |
+
* bump Gradio to 3.29.0
|
110 |
+
* bump PyTorch to 2.0.1
|
111 |
+
* `--subpath` option for gradio for use with reverse proxy
|
112 |
+
* Linux/macOS: use existing virtualenv if already active (the VIRTUAL_ENV environment variable)
|
113 |
+
* do not apply localizations if there are none (possible frontend optimization)
|
114 |
+
* add extra `None` option for VAE in XYZ plot
|
115 |
+
* print error to console when batch processing in img2img fails
|
116 |
+
* create HTML for extra network pages only on demand
|
117 |
+
* allow directories starting with `.` to still list their models for LoRA, checkpoints, etc
|
118 |
+
* put infotext options into their own category in settings tab
|
119 |
+
* do not show licenses page when user selects Show all pages in settings
|
120 |
+
|
121 |
+
### Extensions:
|
122 |
+
* tooltip localization support
|
123 |
+
* add API method to get LoRA models with prompt
|
124 |
+
|
125 |
+
### Bug Fixes:
|
126 |
+
* re-add `/docs` endpoint
|
127 |
+
* fix gamepad navigation
|
128 |
+
* make the lightbox fullscreen image function properly
|
129 |
+
* fix squished thumbnails in extras tab
|
130 |
+
* keep "search" filter for extra networks when user refreshes the tab (previously it showed everthing after you refreshed)
|
131 |
+
* fix webui showing the same image if you configure the generation to always save results into same file
|
132 |
+
* fix bug with upscalers not working properly
|
133 |
+
* fix MPS on PyTorch 2.0.1, Intel Macs
|
134 |
+
* make it so that custom context menu from contextMenu.js only disappears after user's click, ignoring non-user click events
|
135 |
+
* prevent Reload UI button/link from reloading the page when it's not yet ready
|
136 |
+
* fix prompts from file script failing to read contents from a drag/drop file
|
137 |
+
|
138 |
+
|
139 |
+
## 1.1.1
|
140 |
+
### Bug Fixes:
|
141 |
+
* fix an error that prevents running webui on PyTorch<2.0 without --disable-safe-unpickle
|
142 |
+
|
143 |
+
## 1.1.0
|
144 |
+
### Features:
|
145 |
+
* switch to PyTorch 2.0.0 (except for AMD GPUs)
|
146 |
+
* visual improvements to custom code scripts
|
147 |
+
* add filename patterns: `[clip_skip]`, `[hasprompt<>]`, `[batch_number]`, `[generation_number]`
|
148 |
+
* add support for saving init images in img2img, and record their hashes in infotext for reproducability
|
149 |
+
* automatically select current word when adjusting weight with ctrl+up/down
|
150 |
+
* add dropdowns for X/Y/Z plot
|
151 |
+
* add setting: Stable Diffusion/Random number generator source: makes it possible to make images generated from a given manual seed consistent across different GPUs
|
152 |
+
* support Gradio's theme API
|
153 |
+
* use TCMalloc on Linux by default; possible fix for memory leaks
|
154 |
+
* add optimization option to remove negative conditioning at low sigma values #9177
|
155 |
+
* embed model merge metadata in .safetensors file
|
156 |
+
* extension settings backup/restore feature #9169
|
157 |
+
* add "resize by" and "resize to" tabs to img2img
|
158 |
+
* add option "keep original size" to textual inversion images preprocess
|
159 |
+
* image viewer scrolling via analog stick
|
160 |
+
* button to restore the progress from session lost / tab reload
|
161 |
+
|
162 |
+
### Minor:
|
163 |
+
* bump Gradio to 3.28.1
|
164 |
+
* change "scale to" to sliders in Extras tab
|
165 |
+
* add labels to tool buttons to make it possible to hide them
|
166 |
+
* add tiled inference support for ScuNET
|
167 |
+
* add branch support for extension installation
|
168 |
+
* change Linux installation script to install into current directory rather than `/home/username`
|
169 |
+
* sort textual inversion embeddings by name (case-insensitive)
|
170 |
+
* allow styles.csv to be symlinked or mounted in docker
|
171 |
+
* remove the "do not add watermark to images" option
|
172 |
+
* make selected tab configurable with UI config
|
173 |
+
* make the extra networks UI fixed height and scrollable
|
174 |
+
* add `disable_tls_verify` arg for use with self-signed certs
|
175 |
+
|
176 |
+
### Extensions:
|
177 |
+
* add reload callback
|
178 |
+
* add `is_hr_pass` field for processing
|
179 |
+
|
180 |
+
### Bug Fixes:
|
181 |
+
* fix broken batch image processing on 'Extras/Batch Process' tab
|
182 |
+
* add "None" option to extra networks dropdowns
|
183 |
+
* fix FileExistsError for CLIP Interrogator
|
184 |
+
* fix /sdapi/v1/txt2img endpoint not working on Linux #9319
|
185 |
+
* fix disappearing live previews and progressbar during slow tasks
|
186 |
+
* fix fullscreen image view not working properly in some cases
|
187 |
+
* prevent alwayson_scripts args param resizing script_arg list when they are inserted in it
|
188 |
+
* fix prompt schedule for second order samplers
|
189 |
+
* fix image mask/composite for weird resolutions #9628
|
190 |
+
* use correct images for previews when using AND (see #9491)
|
191 |
+
* one broken image in img2img batch won't stop all processing
|
192 |
+
* fix image orientation bug in train/preprocess
|
193 |
+
* fix Ngrok recreating tunnels every reload
|
194 |
+
* fix `--realesrgan-models-path` and `--ldsr-models-path` not working
|
195 |
+
* fix `--skip-install` not working
|
196 |
+
* use SAMPLE file format in Outpainting Mk2 & Poorman
|
197 |
+
* do not fail all LoRAs if some have failed to load when making a picture
|
198 |
+
|
199 |
+
## 1.0.0
|
200 |
+
* everything
|
CODEOWNERS
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* @AUTOMATIC1111
|
2 |
+
|
3 |
+
# if you were managing a localization and were removed from this file, this is because
|
4 |
+
# the intended way to do localizations now is via extensions. See:
|
5 |
+
# https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions
|
6 |
+
# Make a repo with your localization and since you are still listed as a collaborator
|
7 |
+
# you can add it to the wiki page yourself. This change is because some people complained
|
8 |
+
# the git commit log is cluttered with things unrelated to almost everyone and
|
9 |
+
# because I believe this is the best overall for the project to handle localizations almost
|
10 |
+
# entirely without my oversight.
|
11 |
+
|
12 |
+
|
LICENSE.txt
ADDED
@@ -0,0 +1,663 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 19 November 2007
|
3 |
+
|
4 |
+
Copyright (c) 2023 AUTOMATIC1111
|
5 |
+
|
6 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
7 |
+
Everyone is permitted to copy and distribute verbatim copies
|
8 |
+
of this license document, but changing it is not allowed.
|
9 |
+
|
10 |
+
Preamble
|
11 |
+
|
12 |
+
The GNU Affero General Public License is a free, copyleft license for
|
13 |
+
software and other kinds of works, specifically designed to ensure
|
14 |
+
cooperation with the community in the case of network server software.
|
15 |
+
|
16 |
+
The licenses for most software and other practical works are designed
|
17 |
+
to take away your freedom to share and change the works. By contrast,
|
18 |
+
our General Public Licenses are intended to guarantee your freedom to
|
19 |
+
share and change all versions of a program--to make sure it remains free
|
20 |
+
software for all its users.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
Developers that use our General Public Licenses protect your rights
|
30 |
+
with two steps: (1) assert copyright on the software, and (2) offer
|
31 |
+
you this License which gives you legal permission to copy, distribute
|
32 |
+
and/or modify the software.
|
33 |
+
|
34 |
+
A secondary benefit of defending all users' freedom is that
|
35 |
+
improvements made in alternate versions of the program, if they
|
36 |
+
receive widespread use, become available for other developers to
|
37 |
+
incorporate. Many developers of free software are heartened and
|
38 |
+
encouraged by the resulting cooperation. However, in the case of
|
39 |
+
software used on network servers, this result may fail to come about.
|
40 |
+
The GNU General Public License permits making a modified version and
|
41 |
+
letting the public access it on a server without ever releasing its
|
42 |
+
source code to the public.
|
43 |
+
|
44 |
+
The GNU Affero General Public License is designed specifically to
|
45 |
+
ensure that, in such cases, the modified source code becomes available
|
46 |
+
to the community. It requires the operator of a network server to
|
47 |
+
provide the source code of the modified version running there to the
|
48 |
+
users of that server. Therefore, public use of a modified version, on
|
49 |
+
a publicly accessible server, gives the public access to the source
|
50 |
+
code of the modified version.
|
51 |
+
|
52 |
+
An older license, called the Affero General Public License and
|
53 |
+
published by Affero, was designed to accomplish similar goals. This is
|
54 |
+
a different license, not a version of the Affero GPL, but Affero has
|
55 |
+
released a new version of the Affero GPL which permits relicensing under
|
56 |
+
this license.
|
57 |
+
|
58 |
+
The precise terms and conditions for copying, distribution and
|
59 |
+
modification follow.
|
60 |
+
|
61 |
+
TERMS AND CONDITIONS
|
62 |
+
|
63 |
+
0. Definitions.
|
64 |
+
|
65 |
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
66 |
+
|
67 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
68 |
+
works, such as semiconductor masks.
|
69 |
+
|
70 |
+
"The Program" refers to any copyrightable work licensed under this
|
71 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
72 |
+
"recipients" may be individuals or organizations.
|
73 |
+
|
74 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
75 |
+
in a fashion requiring copyright permission, other than the making of an
|
76 |
+
exact copy. The resulting work is called a "modified version" of the
|
77 |
+
earlier work or a work "based on" the earlier work.
|
78 |
+
|
79 |
+
A "covered work" means either the unmodified Program or a work based
|
80 |
+
on the Program.
|
81 |
+
|
82 |
+
To "propagate" a work means to do anything with it that, without
|
83 |
+
permission, would make you directly or secondarily liable for
|
84 |
+
infringement under applicable copyright law, except executing it on a
|
85 |
+
computer or modifying a private copy. Propagation includes copying,
|
86 |
+
distribution (with or without modification), making available to the
|
87 |
+
public, and in some countries other activities as well.
|
88 |
+
|
89 |
+
To "convey" a work means any kind of propagation that enables other
|
90 |
+
parties to make or receive copies. Mere interaction with a user through
|
91 |
+
a computer network, with no transfer of a copy, is not conveying.
|
92 |
+
|
93 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
94 |
+
to the extent that it includes a convenient and prominently visible
|
95 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
96 |
+
tells the user that there is no warranty for the work (except to the
|
97 |
+
extent that warranties are provided), that licensees may convey the
|
98 |
+
work under this License, and how to view a copy of this License. If
|
99 |
+
the interface presents a list of user commands or options, such as a
|
100 |
+
menu, a prominent item in the list meets this criterion.
|
101 |
+
|
102 |
+
1. Source Code.
|
103 |
+
|
104 |
+
The "source code" for a work means the preferred form of the work
|
105 |
+
for making modifications to it. "Object code" means any non-source
|
106 |
+
form of a work.
|
107 |
+
|
108 |
+
A "Standard Interface" means an interface that either is an official
|
109 |
+
standard defined by a recognized standards body, or, in the case of
|
110 |
+
interfaces specified for a particular programming language, one that
|
111 |
+
is widely used among developers working in that language.
|
112 |
+
|
113 |
+
The "System Libraries" of an executable work include anything, other
|
114 |
+
than the work as a whole, that (a) is included in the normal form of
|
115 |
+
packaging a Major Component, but which is not part of that Major
|
116 |
+
Component, and (b) serves only to enable use of the work with that
|
117 |
+
Major Component, or to implement a Standard Interface for which an
|
118 |
+
implementation is available to the public in source code form. A
|
119 |
+
"Major Component", in this context, means a major essential component
|
120 |
+
(kernel, window system, and so on) of the specific operating system
|
121 |
+
(if any) on which the executable work runs, or a compiler used to
|
122 |
+
produce the work, or an object code interpreter used to run it.
|
123 |
+
|
124 |
+
The "Corresponding Source" for a work in object code form means all
|
125 |
+
the source code needed to generate, install, and (for an executable
|
126 |
+
work) run the object code and to modify the work, including scripts to
|
127 |
+
control those activities. However, it does not include the work's
|
128 |
+
System Libraries, or general-purpose tools or generally available free
|
129 |
+
programs which are used unmodified in performing those activities but
|
130 |
+
which are not part of the work. For example, Corresponding Source
|
131 |
+
includes interface definition files associated with source files for
|
132 |
+
the work, and the source code for shared libraries and dynamically
|
133 |
+
linked subprograms that the work is specifically designed to require,
|
134 |
+
such as by intimate data communication or control flow between those
|
135 |
+
subprograms and other parts of the work.
|
136 |
+
|
137 |
+
The Corresponding Source need not include anything that users
|
138 |
+
can regenerate automatically from other parts of the Corresponding
|
139 |
+
Source.
|
140 |
+
|
141 |
+
The Corresponding Source for a work in source code form is that
|
142 |
+
same work.
|
143 |
+
|
144 |
+
2. Basic Permissions.
|
145 |
+
|
146 |
+
All rights granted under this License are granted for the term of
|
147 |
+
copyright on the Program, and are irrevocable provided the stated
|
148 |
+
conditions are met. This License explicitly affirms your unlimited
|
149 |
+
permission to run the unmodified Program. The output from running a
|
150 |
+
covered work is covered by this License only if the output, given its
|
151 |
+
content, constitutes a covered work. This License acknowledges your
|
152 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
153 |
+
|
154 |
+
You may make, run and propagate covered works that you do not
|
155 |
+
convey, without conditions so long as your license otherwise remains
|
156 |
+
in force. You may convey covered works to others for the sole purpose
|
157 |
+
of having them make modifications exclusively for you, or provide you
|
158 |
+
with facilities for running those works, provided that you comply with
|
159 |
+
the terms of this License in conveying all material for which you do
|
160 |
+
not control copyright. Those thus making or running the covered works
|
161 |
+
for you must do so exclusively on your behalf, under your direction
|
162 |
+
and control, on terms that prohibit them from making any copies of
|
163 |
+
your copyrighted material outside their relationship with you.
|
164 |
+
|
165 |
+
Conveying under any other circumstances is permitted solely under
|
166 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
167 |
+
makes it unnecessary.
|
168 |
+
|
169 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
170 |
+
|
171 |
+
No covered work shall be deemed part of an effective technological
|
172 |
+
measure under any applicable law fulfilling obligations under article
|
173 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
174 |
+
similar laws prohibiting or restricting circumvention of such
|
175 |
+
measures.
|
176 |
+
|
177 |
+
When you convey a covered work, you waive any legal power to forbid
|
178 |
+
circumvention of technological measures to the extent such circumvention
|
179 |
+
is effected by exercising rights under this License with respect to
|
180 |
+
the covered work, and you disclaim any intention to limit operation or
|
181 |
+
modification of the work as a means of enforcing, against the work's
|
182 |
+
users, your or third parties' legal rights to forbid circumvention of
|
183 |
+
technological measures.
|
184 |
+
|
185 |
+
4. Conveying Verbatim Copies.
|
186 |
+
|
187 |
+
You may convey verbatim copies of the Program's source code as you
|
188 |
+
receive it, in any medium, provided that you conspicuously and
|
189 |
+
appropriately publish on each copy an appropriate copyright notice;
|
190 |
+
keep intact all notices stating that this License and any
|
191 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
192 |
+
keep intact all notices of the absence of any warranty; and give all
|
193 |
+
recipients a copy of this License along with the Program.
|
194 |
+
|
195 |
+
You may charge any price or no price for each copy that you convey,
|
196 |
+
and you may offer support or warranty protection for a fee.
|
197 |
+
|
198 |
+
5. Conveying Modified Source Versions.
|
199 |
+
|
200 |
+
You may convey a work based on the Program, or the modifications to
|
201 |
+
produce it from the Program, in the form of source code under the
|
202 |
+
terms of section 4, provided that you also meet all of these conditions:
|
203 |
+
|
204 |
+
a) The work must carry prominent notices stating that you modified
|
205 |
+
it, and giving a relevant date.
|
206 |
+
|
207 |
+
b) The work must carry prominent notices stating that it is
|
208 |
+
released under this License and any conditions added under section
|
209 |
+
7. This requirement modifies the requirement in section 4 to
|
210 |
+
"keep intact all notices".
|
211 |
+
|
212 |
+
c) You must license the entire work, as a whole, under this
|
213 |
+
License to anyone who comes into possession of a copy. This
|
214 |
+
License will therefore apply, along with any applicable section 7
|
215 |
+
additional terms, to the whole of the work, and all its parts,
|
216 |
+
regardless of how they are packaged. This License gives no
|
217 |
+
permission to license the work in any other way, but it does not
|
218 |
+
invalidate such permission if you have separately received it.
|
219 |
+
|
220 |
+
d) If the work has interactive user interfaces, each must display
|
221 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
222 |
+
interfaces that do not display Appropriate Legal Notices, your
|
223 |
+
work need not make them do so.
|
224 |
+
|
225 |
+
A compilation of a covered work with other separate and independent
|
226 |
+
works, which are not by their nature extensions of the covered work,
|
227 |
+
and which are not combined with it such as to form a larger program,
|
228 |
+
in or on a volume of a storage or distribution medium, is called an
|
229 |
+
"aggregate" if the compilation and its resulting copyright are not
|
230 |
+
used to limit the access or legal rights of the compilation's users
|
231 |
+
beyond what the individual works permit. Inclusion of a covered work
|
232 |
+
in an aggregate does not cause this License to apply to the other
|
233 |
+
parts of the aggregate.
|
234 |
+
|
235 |
+
6. Conveying Non-Source Forms.
|
236 |
+
|
237 |
+
You may convey a covered work in object code form under the terms
|
238 |
+
of sections 4 and 5, provided that you also convey the
|
239 |
+
machine-readable Corresponding Source under the terms of this License,
|
240 |
+
in one of these ways:
|
241 |
+
|
242 |
+
a) Convey the object code in, or embodied in, a physical product
|
243 |
+
(including a physical distribution medium), accompanied by the
|
244 |
+
Corresponding Source fixed on a durable physical medium
|
245 |
+
customarily used for software interchange.
|
246 |
+
|
247 |
+
b) Convey the object code in, or embodied in, a physical product
|
248 |
+
(including a physical distribution medium), accompanied by a
|
249 |
+
written offer, valid for at least three years and valid for as
|
250 |
+
long as you offer spare parts or customer support for that product
|
251 |
+
model, to give anyone who possesses the object code either (1) a
|
252 |
+
copy of the Corresponding Source for all the software in the
|
253 |
+
product that is covered by this License, on a durable physical
|
254 |
+
medium customarily used for software interchange, for a price no
|
255 |
+
more than your reasonable cost of physically performing this
|
256 |
+
conveying of source, or (2) access to copy the
|
257 |
+
Corresponding Source from a network server at no charge.
|
258 |
+
|
259 |
+
c) Convey individual copies of the object code with a copy of the
|
260 |
+
written offer to provide the Corresponding Source. This
|
261 |
+
alternative is allowed only occasionally and noncommercially, and
|
262 |
+
only if you received the object code with such an offer, in accord
|
263 |
+
with subsection 6b.
|
264 |
+
|
265 |
+
d) Convey the object code by offering access from a designated
|
266 |
+
place (gratis or for a charge), and offer equivalent access to the
|
267 |
+
Corresponding Source in the same way through the same place at no
|
268 |
+
further charge. You need not require recipients to copy the
|
269 |
+
Corresponding Source along with the object code. If the place to
|
270 |
+
copy the object code is a network server, the Corresponding Source
|
271 |
+
may be on a different server (operated by you or a third party)
|
272 |
+
that supports equivalent copying facilities, provided you maintain
|
273 |
+
clear directions next to the object code saying where to find the
|
274 |
+
Corresponding Source. Regardless of what server hosts the
|
275 |
+
Corresponding Source, you remain obligated to ensure that it is
|
276 |
+
available for as long as needed to satisfy these requirements.
|
277 |
+
|
278 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
279 |
+
you inform other peers where the object code and Corresponding
|
280 |
+
Source of the work are being offered to the general public at no
|
281 |
+
charge under subsection 6d.
|
282 |
+
|
283 |
+
A separable portion of the object code, whose source code is excluded
|
284 |
+
from the Corresponding Source as a System Library, need not be
|
285 |
+
included in conveying the object code work.
|
286 |
+
|
287 |
+
A "User Product" is either (1) a "consumer product", which means any
|
288 |
+
tangible personal property which is normally used for personal, family,
|
289 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
290 |
+
into a dwelling. In determining whether a product is a consumer product,
|
291 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
292 |
+
product received by a particular user, "normally used" refers to a
|
293 |
+
typical or common use of that class of product, regardless of the status
|
294 |
+
of the particular user or of the way in which the particular user
|
295 |
+
actually uses, or expects or is expected to use, the product. A product
|
296 |
+
is a consumer product regardless of whether the product has substantial
|
297 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
298 |
+
the only significant mode of use of the product.
|
299 |
+
|
300 |
+
"Installation Information" for a User Product means any methods,
|
301 |
+
procedures, authorization keys, or other information required to install
|
302 |
+
and execute modified versions of a covered work in that User Product from
|
303 |
+
a modified version of its Corresponding Source. The information must
|
304 |
+
suffice to ensure that the continued functioning of the modified object
|
305 |
+
code is in no case prevented or interfered with solely because
|
306 |
+
modification has been made.
|
307 |
+
|
308 |
+
If you convey an object code work under this section in, or with, or
|
309 |
+
specifically for use in, a User Product, and the conveying occurs as
|
310 |
+
part of a transaction in which the right of possession and use of the
|
311 |
+
User Product is transferred to the recipient in perpetuity or for a
|
312 |
+
fixed term (regardless of how the transaction is characterized), the
|
313 |
+
Corresponding Source conveyed under this section must be accompanied
|
314 |
+
by the Installation Information. But this requirement does not apply
|
315 |
+
if neither you nor any third party retains the ability to install
|
316 |
+
modified object code on the User Product (for example, the work has
|
317 |
+
been installed in ROM).
|
318 |
+
|
319 |
+
The requirement to provide Installation Information does not include a
|
320 |
+
requirement to continue to provide support service, warranty, or updates
|
321 |
+
for a work that has been modified or installed by the recipient, or for
|
322 |
+
the User Product in which it has been modified or installed. Access to a
|
323 |
+
network may be denied when the modification itself materially and
|
324 |
+
adversely affects the operation of the network or violates the rules and
|
325 |
+
protocols for communication across the network.
|
326 |
+
|
327 |
+
Corresponding Source conveyed, and Installation Information provided,
|
328 |
+
in accord with this section must be in a format that is publicly
|
329 |
+
documented (and with an implementation available to the public in
|
330 |
+
source code form), and must require no special password or key for
|
331 |
+
unpacking, reading or copying.
|
332 |
+
|
333 |
+
7. Additional Terms.
|
334 |
+
|
335 |
+
"Additional permissions" are terms that supplement the terms of this
|
336 |
+
License by making exceptions from one or more of its conditions.
|
337 |
+
Additional permissions that are applicable to the entire Program shall
|
338 |
+
be treated as though they were included in this License, to the extent
|
339 |
+
that they are valid under applicable law. If additional permissions
|
340 |
+
apply only to part of the Program, that part may be used separately
|
341 |
+
under those permissions, but the entire Program remains governed by
|
342 |
+
this License without regard to the additional permissions.
|
343 |
+
|
344 |
+
When you convey a copy of a covered work, you may at your option
|
345 |
+
remove any additional permissions from that copy, or from any part of
|
346 |
+
it. (Additional permissions may be written to require their own
|
347 |
+
removal in certain cases when you modify the work.) You may place
|
348 |
+
additional permissions on material, added by you to a covered work,
|
349 |
+
for which you have or can give appropriate copyright permission.
|
350 |
+
|
351 |
+
Notwithstanding any other provision of this License, for material you
|
352 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
353 |
+
that material) supplement the terms of this License with terms:
|
354 |
+
|
355 |
+
a) Disclaiming warranty or limiting liability differently from the
|
356 |
+
terms of sections 15 and 16 of this License; or
|
357 |
+
|
358 |
+
b) Requiring preservation of specified reasonable legal notices or
|
359 |
+
author attributions in that material or in the Appropriate Legal
|
360 |
+
Notices displayed by works containing it; or
|
361 |
+
|
362 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
363 |
+
requiring that modified versions of such material be marked in
|
364 |
+
reasonable ways as different from the original version; or
|
365 |
+
|
366 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
367 |
+
authors of the material; or
|
368 |
+
|
369 |
+
e) Declining to grant rights under trademark law for use of some
|
370 |
+
trade names, trademarks, or service marks; or
|
371 |
+
|
372 |
+
f) Requiring indemnification of licensors and authors of that
|
373 |
+
material by anyone who conveys the material (or modified versions of
|
374 |
+
it) with contractual assumptions of liability to the recipient, for
|
375 |
+
any liability that these contractual assumptions directly impose on
|
376 |
+
those licensors and authors.
|
377 |
+
|
378 |
+
All other non-permissive additional terms are considered "further
|
379 |
+
restrictions" within the meaning of section 10. If the Program as you
|
380 |
+
received it, or any part of it, contains a notice stating that it is
|
381 |
+
governed by this License along with a term that is a further
|
382 |
+
restriction, you may remove that term. If a license document contains
|
383 |
+
a further restriction but permits relicensing or conveying under this
|
384 |
+
License, you may add to a covered work material governed by the terms
|
385 |
+
of that license document, provided that the further restriction does
|
386 |
+
not survive such relicensing or conveying.
|
387 |
+
|
388 |
+
If you add terms to a covered work in accord with this section, you
|
389 |
+
must place, in the relevant source files, a statement of the
|
390 |
+
additional terms that apply to those files, or a notice indicating
|
391 |
+
where to find the applicable terms.
|
392 |
+
|
393 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
394 |
+
form of a separately written license, or stated as exceptions;
|
395 |
+
the above requirements apply either way.
|
396 |
+
|
397 |
+
8. Termination.
|
398 |
+
|
399 |
+
You may not propagate or modify a covered work except as expressly
|
400 |
+
provided under this License. Any attempt otherwise to propagate or
|
401 |
+
modify it is void, and will automatically terminate your rights under
|
402 |
+
this License (including any patent licenses granted under the third
|
403 |
+
paragraph of section 11).
|
404 |
+
|
405 |
+
However, if you cease all violation of this License, then your
|
406 |
+
license from a particular copyright holder is reinstated (a)
|
407 |
+
provisionally, unless and until the copyright holder explicitly and
|
408 |
+
finally terminates your license, and (b) permanently, if the copyright
|
409 |
+
holder fails to notify you of the violation by some reasonable means
|
410 |
+
prior to 60 days after the cessation.
|
411 |
+
|
412 |
+
Moreover, your license from a particular copyright holder is
|
413 |
+
reinstated permanently if the copyright holder notifies you of the
|
414 |
+
violation by some reasonable means, this is the first time you have
|
415 |
+
received notice of violation of this License (for any work) from that
|
416 |
+
copyright holder, and you cure the violation prior to 30 days after
|
417 |
+
your receipt of the notice.
|
418 |
+
|
419 |
+
Termination of your rights under this section does not terminate the
|
420 |
+
licenses of parties who have received copies or rights from you under
|
421 |
+
this License. If your rights have been terminated and not permanently
|
422 |
+
reinstated, you do not qualify to receive new licenses for the same
|
423 |
+
material under section 10.
|
424 |
+
|
425 |
+
9. Acceptance Not Required for Having Copies.
|
426 |
+
|
427 |
+
You are not required to accept this License in order to receive or
|
428 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
429 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
430 |
+
to receive a copy likewise does not require acceptance. However,
|
431 |
+
nothing other than this License grants you permission to propagate or
|
432 |
+
modify any covered work. These actions infringe copyright if you do
|
433 |
+
not accept this License. Therefore, by modifying or propagating a
|
434 |
+
covered work, you indicate your acceptance of this License to do so.
|
435 |
+
|
436 |
+
10. Automatic Licensing of Downstream Recipients.
|
437 |
+
|
438 |
+
Each time you convey a covered work, the recipient automatically
|
439 |
+
receives a license from the original licensors, to run, modify and
|
440 |
+
propagate that work, subject to this License. You are not responsible
|
441 |
+
for enforcing compliance by third parties with this License.
|
442 |
+
|
443 |
+
An "entity transaction" is a transaction transferring control of an
|
444 |
+
organization, or substantially all assets of one, or subdividing an
|
445 |
+
organization, or merging organizations. If propagation of a covered
|
446 |
+
work results from an entity transaction, each party to that
|
447 |
+
transaction who receives a copy of the work also receives whatever
|
448 |
+
licenses to the work the party's predecessor in interest had or could
|
449 |
+
give under the previous paragraph, plus a right to possession of the
|
450 |
+
Corresponding Source of the work from the predecessor in interest, if
|
451 |
+
the predecessor has it or can get it with reasonable efforts.
|
452 |
+
|
453 |
+
You may not impose any further restrictions on the exercise of the
|
454 |
+
rights granted or affirmed under this License. For example, you may
|
455 |
+
not impose a license fee, royalty, or other charge for exercise of
|
456 |
+
rights granted under this License, and you may not initiate litigation
|
457 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
458 |
+
any patent claim is infringed by making, using, selling, offering for
|
459 |
+
sale, or importing the Program or any portion of it.
|
460 |
+
|
461 |
+
11. Patents.
|
462 |
+
|
463 |
+
A "contributor" is a copyright holder who authorizes use under this
|
464 |
+
License of the Program or a work on which the Program is based. The
|
465 |
+
work thus licensed is called the contributor's "contributor version".
|
466 |
+
|
467 |
+
A contributor's "essential patent claims" are all patent claims
|
468 |
+
owned or controlled by the contributor, whether already acquired or
|
469 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
470 |
+
by this License, of making, using, or selling its contributor version,
|
471 |
+
but do not include claims that would be infringed only as a
|
472 |
+
consequence of further modification of the contributor version. For
|
473 |
+
purposes of this definition, "control" includes the right to grant
|
474 |
+
patent sublicenses in a manner consistent with the requirements of
|
475 |
+
this License.
|
476 |
+
|
477 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
478 |
+
patent license under the contributor's essential patent claims, to
|
479 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
480 |
+
propagate the contents of its contributor version.
|
481 |
+
|
482 |
+
In the following three paragraphs, a "patent license" is any express
|
483 |
+
agreement or commitment, however denominated, not to enforce a patent
|
484 |
+
(such as an express permission to practice a patent or covenant not to
|
485 |
+
sue for patent infringement). To "grant" such a patent license to a
|
486 |
+
party means to make such an agreement or commitment not to enforce a
|
487 |
+
patent against the party.
|
488 |
+
|
489 |
+
If you convey a covered work, knowingly relying on a patent license,
|
490 |
+
and the Corresponding Source of the work is not available for anyone
|
491 |
+
to copy, free of charge and under the terms of this License, through a
|
492 |
+
publicly available network server or other readily accessible means,
|
493 |
+
then you must either (1) cause the Corresponding Source to be so
|
494 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
495 |
+
patent license for this particular work, or (3) arrange, in a manner
|
496 |
+
consistent with the requirements of this License, to extend the patent
|
497 |
+
license to downstream recipients. "Knowingly relying" means you have
|
498 |
+
actual knowledge that, but for the patent license, your conveying the
|
499 |
+
covered work in a country, or your recipient's use of the covered work
|
500 |
+
in a country, would infringe one or more identifiable patents in that
|
501 |
+
country that you have reason to believe are valid.
|
502 |
+
|
503 |
+
If, pursuant to or in connection with a single transaction or
|
504 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
505 |
+
covered work, and grant a patent license to some of the parties
|
506 |
+
receiving the covered work authorizing them to use, propagate, modify
|
507 |
+
or convey a specific copy of the covered work, then the patent license
|
508 |
+
you grant is automatically extended to all recipients of the covered
|
509 |
+
work and works based on it.
|
510 |
+
|
511 |
+
A patent license is "discriminatory" if it does not include within
|
512 |
+
the scope of its coverage, prohibits the exercise of, or is
|
513 |
+
conditioned on the non-exercise of one or more of the rights that are
|
514 |
+
specifically granted under this License. You may not convey a covered
|
515 |
+
work if you are a party to an arrangement with a third party that is
|
516 |
+
in the business of distributing software, under which you make payment
|
517 |
+
to the third party based on the extent of your activity of conveying
|
518 |
+
the work, and under which the third party grants, to any of the
|
519 |
+
parties who would receive the covered work from you, a discriminatory
|
520 |
+
patent license (a) in connection with copies of the covered work
|
521 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
522 |
+
for and in connection with specific products or compilations that
|
523 |
+
contain the covered work, unless you entered into that arrangement,
|
524 |
+
or that patent license was granted, prior to 28 March 2007.
|
525 |
+
|
526 |
+
Nothing in this License shall be construed as excluding or limiting
|
527 |
+
any implied license or other defenses to infringement that may
|
528 |
+
otherwise be available to you under applicable patent law.
|
529 |
+
|
530 |
+
12. No Surrender of Others' Freedom.
|
531 |
+
|
532 |
+
If conditions are imposed on you (whether by court order, agreement or
|
533 |
+
otherwise) that contradict the conditions of this License, they do not
|
534 |
+
excuse you from the conditions of this License. If you cannot convey a
|
535 |
+
covered work so as to satisfy simultaneously your obligations under this
|
536 |
+
License and any other pertinent obligations, then as a consequence you may
|
537 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
538 |
+
to collect a royalty for further conveying from those to whom you convey
|
539 |
+
the Program, the only way you could satisfy both those terms and this
|
540 |
+
License would be to refrain entirely from conveying the Program.
|
541 |
+
|
542 |
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
543 |
+
|
544 |
+
Notwithstanding any other provision of this License, if you modify the
|
545 |
+
Program, your modified version must prominently offer all users
|
546 |
+
interacting with it remotely through a computer network (if your version
|
547 |
+
supports such interaction) an opportunity to receive the Corresponding
|
548 |
+
Source of your version by providing access to the Corresponding Source
|
549 |
+
from a network server at no charge, through some standard or customary
|
550 |
+
means of facilitating copying of software. This Corresponding Source
|
551 |
+
shall include the Corresponding Source for any work covered by version 3
|
552 |
+
of the GNU General Public License that is incorporated pursuant to the
|
553 |
+
following paragraph.
|
554 |
+
|
555 |
+
Notwithstanding any other provision of this License, you have
|
556 |
+
permission to link or combine any covered work with a work licensed
|
557 |
+
under version 3 of the GNU General Public License into a single
|
558 |
+
combined work, and to convey the resulting work. The terms of this
|
559 |
+
License will continue to apply to the part which is the covered work,
|
560 |
+
but the work with which it is combined will remain governed by version
|
561 |
+
3 of the GNU General Public License.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU Affero General Public License from time to time. Such new versions
|
567 |
+
will be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU Affero General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU Affero General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU Affero General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
635 |
+
Copyright (C) <year> <name of author>
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU Affero General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU Affero General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU Affero General Public License
|
648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If your software can interact with users remotely through a computer
|
653 |
+
network, you should also make sure that it provides a way for users to
|
654 |
+
get its source. For example, if your program is a web application, its
|
655 |
+
interface could display a "Source" link that leads users to an archive
|
656 |
+
of the code. There are many ways you could offer source, and different
|
657 |
+
solutions will be better for different programs; see section 13 for the
|
658 |
+
specific requirements.
|
659 |
+
|
660 |
+
You should also get your employer (if you work as a programmer) or school,
|
661 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
662 |
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
663 |
+
<https://www.gnu.org/licenses/>.
|
README.md
CHANGED
@@ -1,20 +1,169 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
## Documentation
|
17 |
-
[
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
https://
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stable Diffusion web UI
|
2 |
+
A browser interface based on Gradio library for Stable Diffusion.
|
3 |
+
|
4 |
+
![](screenshot.png)
|
5 |
+
|
6 |
+
## Features
|
7 |
+
[Detailed feature showcase with images](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features):
|
8 |
+
- Original txt2img and img2img modes
|
9 |
+
- One click install and run script (but you still must install python and git)
|
10 |
+
- Outpainting
|
11 |
+
- Inpainting
|
12 |
+
- Color Sketch
|
13 |
+
- Prompt Matrix
|
14 |
+
- Stable Diffusion Upscale
|
15 |
+
- Attention, specify parts of text that the model should pay more attention to
|
16 |
+
- a man in a `((tuxedo))` - will pay more attention to tuxedo
|
17 |
+
- a man in a `(tuxedo:1.21)` - alternative syntax
|
18 |
+
- select text and press `Ctrl+Up` or `Ctrl+Down` (or `Command+Up` or `Command+Down` if you're on a MacOS) to automatically adjust attention to selected text (code contributed by anonymous user)
|
19 |
+
- Loopback, run img2img processing multiple times
|
20 |
+
- X/Y/Z plot, a way to draw a 3 dimensional plot of images with different parameters
|
21 |
+
- Textual Inversion
|
22 |
+
- have as many embeddings as you want and use any names you like for them
|
23 |
+
- use multiple embeddings with different numbers of vectors per token
|
24 |
+
- works with half precision floating point numbers
|
25 |
+
- train embeddings on 8GB (also reports of 6GB working)
|
26 |
+
- Extras tab with:
|
27 |
+
- GFPGAN, neural network that fixes faces
|
28 |
+
- CodeFormer, face restoration tool as an alternative to GFPGAN
|
29 |
+
- RealESRGAN, neural network upscaler
|
30 |
+
- ESRGAN, neural network upscaler with a lot of third party models
|
31 |
+
- SwinIR and Swin2SR ([see here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/2092)), neural network upscalers
|
32 |
+
- LDSR, Latent diffusion super resolution upscaling
|
33 |
+
- Resizing aspect ratio options
|
34 |
+
- Sampling method selection
|
35 |
+
- Adjust sampler eta values (noise multiplier)
|
36 |
+
- More advanced noise setting options
|
37 |
+
- Interrupt processing at any time
|
38 |
+
- 4GB video card support (also reports of 2GB working)
|
39 |
+
- Correct seeds for batches
|
40 |
+
- Live prompt token length validation
|
41 |
+
- Generation parameters
|
42 |
+
- parameters you used to generate images are saved with that image
|
43 |
+
- in PNG chunks for PNG, in EXIF for JPEG
|
44 |
+
- can drag the image to PNG info tab to restore generation parameters and automatically copy them into UI
|
45 |
+
- can be disabled in settings
|
46 |
+
- drag and drop an image/text-parameters to promptbox
|
47 |
+
- Read Generation Parameters Button, loads parameters in promptbox to UI
|
48 |
+
- Settings page
|
49 |
+
- Running arbitrary python code from UI (must run with `--allow-code` to enable)
|
50 |
+
- Mouseover hints for most UI elements
|
51 |
+
- Possible to change defaults/mix/max/step values for UI elements via text config
|
52 |
+
- Tiling support, a checkbox to create images that can be tiled like textures
|
53 |
+
- Progress bar and live image generation preview
|
54 |
+
- Can use a separate neural network to produce previews with almost none VRAM or compute requirement
|
55 |
+
- Negative prompt, an extra text field that allows you to list what you don't want to see in generated image
|
56 |
+
- Styles, a way to save part of prompt and easily apply them via dropdown later
|
57 |
+
- Variations, a way to generate same image but with tiny differences
|
58 |
+
- Seed resizing, a way to generate same image but at slightly different resolution
|
59 |
+
- CLIP interrogator, a button that tries to guess prompt from an image
|
60 |
+
- Prompt Editing, a way to change prompt mid-generation, say to start making a watermelon and switch to anime girl midway
|
61 |
+
- Batch Processing, process a group of files using img2img
|
62 |
+
- Img2img Alternative, reverse Euler method of cross attention control
|
63 |
+
- Highres Fix, a convenience option to produce high resolution pictures in one click without usual distortions
|
64 |
+
- Reloading checkpoints on the fly
|
65 |
+
- Checkpoint Merger, a tab that allows you to merge up to 3 checkpoints into one
|
66 |
+
- [Custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts) with many extensions from community
|
67 |
+
- [Composable-Diffusion](https://energy-based-model.github.io/Compositional-Visual-Generation-with-Composable-Diffusion-Models/), a way to use multiple prompts at once
|
68 |
+
- separate prompts using uppercase `AND`
|
69 |
+
- also supports weights for prompts: `a cat :1.2 AND a dog AND a penguin :2.2`
|
70 |
+
- No token limit for prompts (original stable diffusion lets you use up to 75 tokens)
|
71 |
+
- DeepDanbooru integration, creates danbooru style tags for anime prompts
|
72 |
+
- [xformers](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Xformers), major speed increase for select cards: (add `--xformers` to commandline args)
|
73 |
+
- via extension: [History tab](https://github.com/yfszzx/stable-diffusion-webui-images-browser): view, direct and delete images conveniently within the UI
|
74 |
+
- Generate forever option
|
75 |
+
- Training tab
|
76 |
+
- hypernetworks and embeddings options
|
77 |
+
- Preprocessing images: cropping, mirroring, autotagging using BLIP or deepdanbooru (for anime)
|
78 |
+
- Clip skip
|
79 |
+
- Hypernetworks
|
80 |
+
- Loras (same as Hypernetworks but more pretty)
|
81 |
+
- A sparate UI where you can choose, with preview, which embeddings, hypernetworks or Loras to add to your prompt
|
82 |
+
- Can select to load a different VAE from settings screen
|
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 |
+
- via extension: [Aesthetic Gradients](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients), a way to generate images with a specific aesthetic by using clip images embeds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
|
87 |
+
- [Stable Diffusion 2.0](https://github.com/Stability-AI/stablediffusion) support - see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#stable-diffusion-20) for instructions
|
88 |
+
- [Alt-Diffusion](https://arxiv.org/abs/2211.06679) support - see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#alt-diffusion) for instructions
|
89 |
+
- Now without any bad letters!
|
90 |
+
- Load checkpoints in safetensors format
|
91 |
+
- Eased resolution restriction: generated image's domension must be a multiple of 8 rather than 64
|
92 |
+
- Now with a license!
|
93 |
+
- Reorder elements in the UI from settings screen
|
94 |
+
|
95 |
+
## Installation and Running
|
96 |
+
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.
|
97 |
+
|
98 |
+
Alternatively, use online services (like Google Colab):
|
99 |
+
|
100 |
+
- [List of Online Services](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Online-Services)
|
101 |
+
|
102 |
+
### Installation on Windows 10/11 with NVidia-GPUs using release package
|
103 |
+
1. Download `sd.webui.zip` from [v1.0.0-pre](https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/tag/v1.0.0-pre) and extract it's contents.
|
104 |
+
2. Run `update.bat`.
|
105 |
+
3. Run `run.bat`.
|
106 |
+
> For more details see [Install-and-Run-on-NVidia-GPUs](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs)
|
107 |
+
|
108 |
+
### Automatic Installation on Windows
|
109 |
+
1. Install [Python 3.10.6](https://www.python.org/downloads/release/python-3106/) (Newer version of Python does not support torch), checking "Add Python to PATH".
|
110 |
+
2. Install [git](https://git-scm.com/download/win).
|
111 |
+
3. Download the stable-diffusion-webui repository, for example by running `git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git`.
|
112 |
+
4. Run `webui-user.bat` from Windows Explorer as normal, non-administrator, user.
|
113 |
+
|
114 |
+
### Automatic Installation on Linux
|
115 |
+
1. Install the dependencies:
|
116 |
+
```bash
|
117 |
+
# Debian-based:
|
118 |
+
sudo apt install wget git python3 python3-venv
|
119 |
+
# Red Hat-based:
|
120 |
+
sudo dnf install wget git python3
|
121 |
+
# Arch-based:
|
122 |
+
sudo pacman -S wget git python3
|
123 |
+
```
|
124 |
+
2. Navigate to the directory you would like the webui to be installed and execute the following command:
|
125 |
+
```bash
|
126 |
+
bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
|
127 |
+
```
|
128 |
+
3. Run `webui.sh`.
|
129 |
+
4. Check `webui-user.sh` for options.
|
130 |
+
### Installation on Apple Silicon
|
131 |
+
|
132 |
+
Find the instructions [here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon).
|
133 |
+
|
134 |
+
## Contributing
|
135 |
+
Here's how to add code to this repo: [Contributing](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Contributing)
|
136 |
|
137 |
## Documentation
|
138 |
+
The documentation was moved from this README over to the project's [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki).
|
139 |
+
|
140 |
+
## Credits
|
141 |
+
Licenses for borrowed code can be found in `Settings -> Licenses` screen, and also in `html/licenses.html` file.
|
142 |
|
143 |
+
- Stable Diffusion - https://github.com/CompVis/stable-diffusion, https://github.com/CompVis/taming-transformers
|
144 |
+
- k-diffusion - https://github.com/crowsonkb/k-diffusion.git
|
145 |
+
- GFPGAN - https://github.com/TencentARC/GFPGAN.git
|
146 |
+
- CodeFormer - https://github.com/sczhou/CodeFormer
|
147 |
+
- ESRGAN - https://github.com/xinntao/ESRGAN
|
148 |
+
- SwinIR - https://github.com/JingyunLiang/SwinIR
|
149 |
+
- Swin2SR - https://github.com/mv-lab/swin2sr
|
150 |
+
- LDSR - https://github.com/Hafiidz/latent-diffusion
|
151 |
+
- MiDaS - https://github.com/isl-org/MiDaS
|
152 |
+
- Ideas for optimizations - https://github.com/basujindal/stable-diffusion
|
153 |
+
- Cross Attention layer optimization - Doggettx - https://github.com/Doggettx/stable-diffusion, original idea for prompt editing.
|
154 |
+
- Cross Attention layer optimization - InvokeAI, lstein - https://github.com/invoke-ai/InvokeAI (originally http://github.com/lstein/stable-diffusion)
|
155 |
+
- Sub-quadratic Cross Attention layer optimization - Alex Birch (https://github.com/Birch-san/diffusers/pull/1), Amin Rezaei (https://github.com/AminRezaei0x443/memory-efficient-attention)
|
156 |
+
- Textual Inversion - Rinon Gal - https://github.com/rinongal/textual_inversion (we're not using his code, but we are using his ideas).
|
157 |
+
- Idea for SD upscale - https://github.com/jquesnelle/txt2imghd
|
158 |
+
- Noise generation for outpainting mk2 - https://github.com/parlance-zz/g-diffuser-bot
|
159 |
+
- CLIP interrogator idea and borrowing some code - https://github.com/pharmapsychotic/clip-interrogator
|
160 |
+
- Idea for Composable Diffusion - https://github.com/energy-based-model/Compositional-Visual-Generation-with-Composable-Diffusion-Models-PyTorch
|
161 |
+
- xformers - https://github.com/facebookresearch/xformers
|
162 |
+
- DeepDanbooru - interrogator for anime diffusers https://github.com/KichangKim/DeepDanbooru
|
163 |
+
- Sampling in float32 precision from a float16 UNet - marunine for the idea, Birch-san for the example Diffusers implementation (https://github.com/Birch-san/diffusers-play/tree/92feee6)
|
164 |
+
- Instruct pix2pix - Tim Brooks (star), Aleksander Holynski (star), Alexei A. Efros (no star) - https://github.com/timothybrooks/instruct-pix2pix
|
165 |
+
- Security advice - RyotaK
|
166 |
+
- UniPC sampler - Wenliang Zhao - https://github.com/wl-zhao/UniPC
|
167 |
+
- TAESD - Ollin Boer Bohan - https://github.com/madebyollin/taesd
|
168 |
+
- Initial Gradio script - posted on 4chan by an Anonymous user. Thank you Anonymous user.
|
169 |
+
- (You)
|
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=23.0
|
8 |
+
- cudatoolkit=11.8
|
9 |
+
- pytorch=2.0
|
10 |
+
- torchvision=0.15
|
11 |
+
- numpy=1.23
|
launch.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from modules import launch_utils
|
2 |
+
|
3 |
+
|
4 |
+
args = launch_utils.args
|
5 |
+
python = launch_utils.python
|
6 |
+
git = launch_utils.git
|
7 |
+
index_url = launch_utils.index_url
|
8 |
+
dir_repos = launch_utils.dir_repos
|
9 |
+
|
10 |
+
commit_hash = launch_utils.commit_hash
|
11 |
+
git_tag = launch_utils.git_tag
|
12 |
+
|
13 |
+
run = launch_utils.run
|
14 |
+
is_installed = launch_utils.is_installed
|
15 |
+
repo_dir = launch_utils.repo_dir
|
16 |
+
|
17 |
+
run_pip = launch_utils.run_pip
|
18 |
+
check_run_python = launch_utils.check_run_python
|
19 |
+
git_clone = launch_utils.git_clone
|
20 |
+
git_pull_recursive = launch_utils.git_pull_recursive
|
21 |
+
run_extension_installer = launch_utils.run_extension_installer
|
22 |
+
prepare_environment = launch_utils.prepare_environment
|
23 |
+
configure_for_tests = launch_utils.configure_for_tests
|
24 |
+
start = launch_utils.start
|
25 |
+
|
26 |
+
|
27 |
+
def main():
|
28 |
+
if not args.skip_prepare_environment:
|
29 |
+
prepare_environment()
|
30 |
+
|
31 |
+
if args.test_server:
|
32 |
+
configure_for_tests()
|
33 |
+
|
34 |
+
start()
|
35 |
+
|
36 |
+
|
37 |
+
if __name__ == "__main__":
|
38 |
+
main()
|
package.json
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "stable-diffusion-webui",
|
3 |
+
"version": "0.0.0",
|
4 |
+
"devDependencies": {
|
5 |
+
"eslint": "^8.40.0"
|
6 |
+
},
|
7 |
+
"scripts": {
|
8 |
+
"lint": "eslint .",
|
9 |
+
"fix": "eslint --fix ."
|
10 |
+
}
|
11 |
+
}
|
pyproject.toml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.ruff]
|
2 |
+
|
3 |
+
target-version = "py39"
|
4 |
+
|
5 |
+
extend-select = [
|
6 |
+
"B",
|
7 |
+
"C",
|
8 |
+
"I",
|
9 |
+
"W",
|
10 |
+
]
|
11 |
+
|
12 |
+
exclude = [
|
13 |
+
"extensions",
|
14 |
+
"extensions-disabled",
|
15 |
+
]
|
16 |
+
|
17 |
+
ignore = [
|
18 |
+
"E501", # Line too long
|
19 |
+
"E731", # Do not assign a `lambda` expression, use a `def`
|
20 |
+
|
21 |
+
"I001", # Import block is un-sorted or un-formatted
|
22 |
+
"C901", # Function is too complex
|
23 |
+
"C408", # Rewrite as a literal
|
24 |
+
"W605", # invalid escape sequence, messes with some docstrings
|
25 |
+
]
|
26 |
+
|
27 |
+
[tool.ruff.per-file-ignores]
|
28 |
+
"webui.py" = ["E402"] # Module level import not at top of file
|
29 |
+
|
30 |
+
[tool.ruff.flake8-bugbear]
|
31 |
+
# Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`.
|
32 |
+
extend-immutable-calls = ["fastapi.Depends", "fastapi.security.HTTPBasic"]
|
33 |
+
|
34 |
+
[tool.pytest.ini_options]
|
35 |
+
base_url = "http://127.0.0.1:7860"
|
requirements-test.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pytest-base-url~=2.0
|
2 |
+
pytest-cov~=4.0
|
3 |
+
pytest~=7.3
|
requirements.txt
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
astunparse
|
2 |
+
blendmodes
|
3 |
+
accelerate
|
4 |
+
basicsr
|
5 |
+
gfpgan
|
6 |
+
gradio==3.31.0
|
7 |
+
numpy
|
8 |
+
omegaconf
|
9 |
+
opencv-contrib-python
|
10 |
+
requests
|
11 |
+
piexif
|
12 |
+
Pillow
|
13 |
+
pytorch_lightning==1.7.7
|
14 |
+
realesrgan
|
15 |
+
scikit-image>=0.19
|
16 |
+
timm==0.4.12
|
17 |
+
transformers==4.25.1
|
18 |
+
torch
|
19 |
+
einops
|
20 |
+
jsonmerge
|
21 |
+
clean-fid
|
22 |
+
resize-right
|
23 |
+
torchdiffeq
|
24 |
+
kornia
|
25 |
+
lark
|
26 |
+
inflection
|
27 |
+
GitPython
|
28 |
+
torchsde
|
29 |
+
safetensors
|
30 |
+
psutil
|
31 |
+
rich
|
32 |
+
tomesd
|
requirements_versions.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
blendmodes==2022
|
2 |
+
transformers==4.25.1
|
3 |
+
accelerate==0.18.0
|
4 |
+
basicsr==1.4.2
|
5 |
+
gfpgan==1.3.8
|
6 |
+
gradio==3.32.0
|
7 |
+
numpy==1.23.5
|
8 |
+
Pillow==9.5.0
|
9 |
+
realesrgan==0.3.0
|
10 |
+
torch
|
11 |
+
omegaconf==2.2.3
|
12 |
+
pytorch_lightning==1.9.4
|
13 |
+
scikit-image==0.20.0
|
14 |
+
timm==0.6.7
|
15 |
+
piexif==1.1.3
|
16 |
+
einops==0.4.1
|
17 |
+
jsonmerge==1.8.0
|
18 |
+
clean-fid==0.1.35
|
19 |
+
resize-right==0.0.2
|
20 |
+
torchdiffeq==0.2.3
|
21 |
+
kornia==0.6.7
|
22 |
+
lark==1.1.2
|
23 |
+
inflection==0.5.1
|
24 |
+
GitPython==3.1.30
|
25 |
+
torchsde==0.2.5
|
26 |
+
safetensors==0.3.1
|
27 |
+
httpcore<=0.15
|
28 |
+
fastapi==0.94.0
|
29 |
+
tomesd==0.1.2
|
screenshot.png
ADDED
script.js
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function gradioApp() {
|
2 |
+
const elems = document.getElementsByTagName('gradio-app');
|
3 |
+
const elem = elems.length == 0 ? document : elems[0];
|
4 |
+
|
5 |
+
if (elem !== document) {
|
6 |
+
elem.getElementById = function(id) {
|
7 |
+
return document.getElementById(id);
|
8 |
+
};
|
9 |
+
}
|
10 |
+
return elem.shadowRoot ? elem.shadowRoot : elem;
|
11 |
+
}
|
12 |
+
|
13 |
+
function get_uiCurrentTab() {
|
14 |
+
return gradioApp().querySelector('#tabs button.selected');
|
15 |
+
}
|
16 |
+
|
17 |
+
function get_uiCurrentTabContent() {
|
18 |
+
return gradioApp().querySelector('.tabitem[id^=tab_]:not([style*="display: none"])');
|
19 |
+
}
|
20 |
+
|
21 |
+
var uiUpdateCallbacks = [];
|
22 |
+
var uiLoadedCallbacks = [];
|
23 |
+
var uiTabChangeCallbacks = [];
|
24 |
+
var optionsChangedCallbacks = [];
|
25 |
+
var uiCurrentTab = null;
|
26 |
+
|
27 |
+
function onUiUpdate(callback) {
|
28 |
+
uiUpdateCallbacks.push(callback);
|
29 |
+
}
|
30 |
+
function onUiLoaded(callback) {
|
31 |
+
uiLoadedCallbacks.push(callback);
|
32 |
+
}
|
33 |
+
function onUiTabChange(callback) {
|
34 |
+
uiTabChangeCallbacks.push(callback);
|
35 |
+
}
|
36 |
+
function onOptionsChanged(callback) {
|
37 |
+
optionsChangedCallbacks.push(callback);
|
38 |
+
}
|
39 |
+
|
40 |
+
function runCallback(x, m) {
|
41 |
+
try {
|
42 |
+
x(m);
|
43 |
+
} catch (e) {
|
44 |
+
(console.error || console.log).call(console, e.message, e);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
function executeCallbacks(queue, m) {
|
48 |
+
queue.forEach(function(x) {
|
49 |
+
runCallback(x, m);
|
50 |
+
});
|
51 |
+
}
|
52 |
+
|
53 |
+
var executedOnLoaded = false;
|
54 |
+
|
55 |
+
document.addEventListener("DOMContentLoaded", function() {
|
56 |
+
var mutationObserver = new MutationObserver(function(m) {
|
57 |
+
if (!executedOnLoaded && gradioApp().querySelector('#txt2img_prompt')) {
|
58 |
+
executedOnLoaded = true;
|
59 |
+
executeCallbacks(uiLoadedCallbacks);
|
60 |
+
}
|
61 |
+
|
62 |
+
executeCallbacks(uiUpdateCallbacks, m);
|
63 |
+
const newTab = get_uiCurrentTab();
|
64 |
+
if (newTab && (newTab !== uiCurrentTab)) {
|
65 |
+
uiCurrentTab = newTab;
|
66 |
+
executeCallbacks(uiTabChangeCallbacks);
|
67 |
+
}
|
68 |
+
});
|
69 |
+
mutationObserver.observe(gradioApp(), {childList: true, subtree: true});
|
70 |
+
});
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Add a ctrl+enter as a shortcut to start a generation
|
74 |
+
*/
|
75 |
+
document.addEventListener('keydown', function(e) {
|
76 |
+
var handled = false;
|
77 |
+
if (e.key !== undefined) {
|
78 |
+
if ((e.key == "Enter" && (e.metaKey || e.ctrlKey || e.altKey))) handled = true;
|
79 |
+
} else if (e.keyCode !== undefined) {
|
80 |
+
if ((e.keyCode == 13 && (e.metaKey || e.ctrlKey || e.altKey))) handled = true;
|
81 |
+
}
|
82 |
+
if (handled) {
|
83 |
+
var button = get_uiCurrentTabContent().querySelector('button[id$=_generate]');
|
84 |
+
if (button) {
|
85 |
+
button.click();
|
86 |
+
}
|
87 |
+
e.preventDefault();
|
88 |
+
}
|
89 |
+
});
|
90 |
+
|
91 |
+
/**
|
92 |
+
* checks that a UI element is not in another hidden element or tab content
|
93 |
+
*/
|
94 |
+
function uiElementIsVisible(el) {
|
95 |
+
if (el === document) {
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
|
99 |
+
const computedStyle = getComputedStyle(el);
|
100 |
+
const isVisible = computedStyle.display !== 'none';
|
101 |
+
|
102 |
+
if (!isVisible) return false;
|
103 |
+
return uiElementIsVisible(el.parentNode);
|
104 |
+
}
|
105 |
+
|
106 |
+
function uiElementInSight(el) {
|
107 |
+
const clRect = el.getBoundingClientRect();
|
108 |
+
const windowHeight = window.innerHeight;
|
109 |
+
const isOnScreen = clRect.bottom > 0 && clRect.top < windowHeight;
|
110 |
+
|
111 |
+
return isOnScreen;
|
112 |
+
}
|
style.css
ADDED
@@ -0,0 +1,926 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* temporary fix to load default gradio font in frontend instead of backend */
|
2 |
+
|
3 |
+
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600&display=swap');
|
4 |
+
|
5 |
+
/* general gradio fixes */
|
6 |
+
|
7 |
+
:root, .dark{
|
8 |
+
--checkbox-label-gap: 0.25em 0.1em;
|
9 |
+
--section-header-text-size: 12pt;
|
10 |
+
--block-background-fill: transparent;
|
11 |
+
}
|
12 |
+
|
13 |
+
.block.padded:not(.gradio-accordion) {
|
14 |
+
padding: 0 !important;
|
15 |
+
}
|
16 |
+
|
17 |
+
div.gradio-container{
|
18 |
+
max-width: unset !important;
|
19 |
+
}
|
20 |
+
|
21 |
+
.hidden{
|
22 |
+
display: none;
|
23 |
+
}
|
24 |
+
|
25 |
+
.compact{
|
26 |
+
background: transparent !important;
|
27 |
+
padding: 0 !important;
|
28 |
+
}
|
29 |
+
|
30 |
+
div.form{
|
31 |
+
border-width: 0;
|
32 |
+
box-shadow: none;
|
33 |
+
background: transparent;
|
34 |
+
overflow: visible;
|
35 |
+
gap: 0.5em;
|
36 |
+
}
|
37 |
+
|
38 |
+
.block.gradio-dropdown,
|
39 |
+
.block.gradio-slider,
|
40 |
+
.block.gradio-checkbox,
|
41 |
+
.block.gradio-textbox,
|
42 |
+
.block.gradio-radio,
|
43 |
+
.block.gradio-checkboxgroup,
|
44 |
+
.block.gradio-number,
|
45 |
+
.block.gradio-colorpicker
|
46 |
+
{
|
47 |
+
border-width: 0 !important;
|
48 |
+
box-shadow: none !important;
|
49 |
+
}
|
50 |
+
|
51 |
+
.gap.compact{
|
52 |
+
padding: 0;
|
53 |
+
gap: 0.2em 0;
|
54 |
+
}
|
55 |
+
|
56 |
+
div.compact{
|
57 |
+
gap: 1em;
|
58 |
+
}
|
59 |
+
|
60 |
+
.gradio-dropdown label span:not(.has-info),
|
61 |
+
.gradio-textbox label span:not(.has-info),
|
62 |
+
.gradio-number label span:not(.has-info)
|
63 |
+
{
|
64 |
+
margin-bottom: 0;
|
65 |
+
}
|
66 |
+
|
67 |
+
.gradio-dropdown ul.options{
|
68 |
+
z-index: 3000;
|
69 |
+
min-width: fit-content;
|
70 |
+
max-width: inherit;
|
71 |
+
white-space: nowrap;
|
72 |
+
}
|
73 |
+
|
74 |
+
.gradio-dropdown ul.options li.item {
|
75 |
+
padding: 0.05em 0;
|
76 |
+
}
|
77 |
+
|
78 |
+
.gradio-dropdown ul.options li.item.selected {
|
79 |
+
background-color: var(--neutral-100);
|
80 |
+
}
|
81 |
+
|
82 |
+
.dark .gradio-dropdown ul.options li.item.selected {
|
83 |
+
background-color: var(--neutral-900);
|
84 |
+
}
|
85 |
+
|
86 |
+
.gradio-dropdown div.wrap.wrap.wrap.wrap{
|
87 |
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
88 |
+
}
|
89 |
+
|
90 |
+
.gradio-dropdown:not(.multiselect) .wrap-inner.wrap-inner.wrap-inner{
|
91 |
+
flex-wrap: unset;
|
92 |
+
}
|
93 |
+
|
94 |
+
.gradio-dropdown .single-select{
|
95 |
+
white-space: nowrap;
|
96 |
+
overflow: hidden;
|
97 |
+
}
|
98 |
+
|
99 |
+
.gradio-dropdown .token-remove.remove-all.remove-all{
|
100 |
+
display: none;
|
101 |
+
}
|
102 |
+
|
103 |
+
.gradio-dropdown.multiselect .token-remove.remove-all.remove-all{
|
104 |
+
display: flex;
|
105 |
+
}
|
106 |
+
|
107 |
+
.gradio-slider input[type="number"]{
|
108 |
+
width: 6em;
|
109 |
+
}
|
110 |
+
|
111 |
+
.block.gradio-checkbox {
|
112 |
+
margin: 0.75em 1.5em 0 0;
|
113 |
+
}
|
114 |
+
|
115 |
+
.gradio-html div.wrap{
|
116 |
+
height: 100%;
|
117 |
+
}
|
118 |
+
div.gradio-html.min{
|
119 |
+
min-height: 0;
|
120 |
+
}
|
121 |
+
|
122 |
+
.block.gradio-gallery{
|
123 |
+
background: var(--input-background-fill);
|
124 |
+
}
|
125 |
+
|
126 |
+
.gradio-container .prose a, .gradio-container .prose a:visited{
|
127 |
+
color: unset;
|
128 |
+
text-decoration: none;
|
129 |
+
}
|
130 |
+
|
131 |
+
a{
|
132 |
+
font-weight: bold;
|
133 |
+
cursor: pointer;
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
/* general styled components */
|
138 |
+
|
139 |
+
.gradio-button.tool{
|
140 |
+
max-width: 2.2em;
|
141 |
+
min-width: 2.2em !important;
|
142 |
+
height: 2.4em;
|
143 |
+
align-self: end;
|
144 |
+
line-height: 1em;
|
145 |
+
border-radius: 0.5em;
|
146 |
+
}
|
147 |
+
|
148 |
+
.gradio-button.secondary-down{
|
149 |
+
background: var(--button-secondary-background-fill);
|
150 |
+
color: var(--button-secondary-text-color);
|
151 |
+
}
|
152 |
+
.gradio-button.secondary-down, .gradio-button.secondary-down:hover{
|
153 |
+
box-shadow: 1px 1px 1px rgba(0,0,0,0.25) inset, 0px 0px 3px rgba(0,0,0,0.15) inset;
|
154 |
+
}
|
155 |
+
.gradio-button.secondary-down:hover{
|
156 |
+
background: var(--button-secondary-background-fill-hover);
|
157 |
+
color: var(--button-secondary-text-color-hover);
|
158 |
+
}
|
159 |
+
|
160 |
+
.checkboxes-row{
|
161 |
+
margin-bottom: 0.5em;
|
162 |
+
margin-left: 0em;
|
163 |
+
}
|
164 |
+
.checkboxes-row > div{
|
165 |
+
flex: 0;
|
166 |
+
white-space: nowrap;
|
167 |
+
min-width: auto;
|
168 |
+
}
|
169 |
+
|
170 |
+
button.custom-button{
|
171 |
+
border-radius: var(--button-large-radius);
|
172 |
+
padding: var(--button-large-padding);
|
173 |
+
font-weight: var(--button-large-text-weight);
|
174 |
+
border: var(--button-border-width) solid var(--button-secondary-border-color);
|
175 |
+
background: var(--button-secondary-background-fill);
|
176 |
+
color: var(--button-secondary-text-color);
|
177 |
+
font-size: var(--button-large-text-size);
|
178 |
+
display: inline-flex;
|
179 |
+
justify-content: center;
|
180 |
+
align-items: center;
|
181 |
+
transition: var(--button-transition);
|
182 |
+
box-shadow: var(--button-shadow);
|
183 |
+
text-align: center;
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
/* txt2img/img2img specific */
|
188 |
+
|
189 |
+
.block.token-counter{
|
190 |
+
position: absolute;
|
191 |
+
display: inline-block;
|
192 |
+
right: 1em;
|
193 |
+
min-width: 0 !important;
|
194 |
+
width: auto;
|
195 |
+
z-index: 100;
|
196 |
+
top: -0.75em;
|
197 |
+
}
|
198 |
+
|
199 |
+
.block.token-counter span{
|
200 |
+
background: var(--input-background-fill) !important;
|
201 |
+
box-shadow: 0 0 0.0 0.3em rgba(192,192,192,0.15), inset 0 0 0.6em rgba(192,192,192,0.075);
|
202 |
+
border: 2px solid rgba(192,192,192,0.4) !important;
|
203 |
+
border-radius: 0.4em;
|
204 |
+
}
|
205 |
+
|
206 |
+
.block.token-counter.error span{
|
207 |
+
box-shadow: 0 0 0.0 0.3em rgba(255,0,0,0.15), inset 0 0 0.6em rgba(255,0,0,0.075);
|
208 |
+
border: 2px solid rgba(255,0,0,0.4) !important;
|
209 |
+
}
|
210 |
+
|
211 |
+
.block.token-counter div{
|
212 |
+
display: inline;
|
213 |
+
}
|
214 |
+
|
215 |
+
.block.token-counter span{
|
216 |
+
padding: 0.1em 0.75em;
|
217 |
+
}
|
218 |
+
|
219 |
+
[id$=_subseed_show]{
|
220 |
+
min-width: auto !important;
|
221 |
+
flex-grow: 0 !important;
|
222 |
+
display: flex;
|
223 |
+
}
|
224 |
+
|
225 |
+
[id$=_subseed_show] label{
|
226 |
+
margin-bottom: 0.5em;
|
227 |
+
align-self: end;
|
228 |
+
}
|
229 |
+
|
230 |
+
.performance {
|
231 |
+
font-size: 0.85em;
|
232 |
+
color: #444;
|
233 |
+
}
|
234 |
+
|
235 |
+
.performance p{
|
236 |
+
display: inline-block;
|
237 |
+
}
|
238 |
+
|
239 |
+
.performance .time {
|
240 |
+
margin-right: 0;
|
241 |
+
}
|
242 |
+
|
243 |
+
.performance .vram {
|
244 |
+
}
|
245 |
+
|
246 |
+
#txt2img_generate, #img2img_generate {
|
247 |
+
min-height: 4.5em;
|
248 |
+
}
|
249 |
+
|
250 |
+
@media screen and (min-width: 2500px) {
|
251 |
+
#txt2img_gallery, #img2img_gallery {
|
252 |
+
min-height: 768px;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
#txt2img_gallery img, #img2img_gallery img, #extras_gallery img{
|
257 |
+
object-fit: scale-down;
|
258 |
+
}
|
259 |
+
#txt2img_actions_column, #img2img_actions_column {
|
260 |
+
gap: 0.5em;
|
261 |
+
}
|
262 |
+
#txt2img_tools, #img2img_tools{
|
263 |
+
gap: 0.4em;
|
264 |
+
}
|
265 |
+
|
266 |
+
.interrogate-col{
|
267 |
+
min-width: 0 !important;
|
268 |
+
max-width: fit-content;
|
269 |
+
gap: 0.5em;
|
270 |
+
}
|
271 |
+
.interrogate-col > button{
|
272 |
+
flex: 1;
|
273 |
+
}
|
274 |
+
|
275 |
+
.generate-box{
|
276 |
+
position: relative;
|
277 |
+
}
|
278 |
+
.gradio-button.generate-box-skip, .gradio-button.generate-box-interrupt{
|
279 |
+
position: absolute;
|
280 |
+
width: 50%;
|
281 |
+
height: 100%;
|
282 |
+
display: none;
|
283 |
+
background: #b4c0cc;
|
284 |
+
}
|
285 |
+
.gradio-button.generate-box-skip:hover, .gradio-button.generate-box-interrupt:hover{
|
286 |
+
background: #c2cfdb;
|
287 |
+
}
|
288 |
+
.gradio-button.generate-box-interrupt{
|
289 |
+
left: 0;
|
290 |
+
border-radius: 0.5rem 0 0 0.5rem;
|
291 |
+
}
|
292 |
+
.gradio-button.generate-box-skip{
|
293 |
+
right: 0;
|
294 |
+
border-radius: 0 0.5rem 0.5rem 0;
|
295 |
+
}
|
296 |
+
|
297 |
+
#txtimg_hr_finalres{
|
298 |
+
min-height: 0 !important;
|
299 |
+
padding: .625rem .75rem;
|
300 |
+
margin-left: -0.75em
|
301 |
+
}
|
302 |
+
|
303 |
+
#img2img_scale_resolution_preview.block{
|
304 |
+
display: flex;
|
305 |
+
align-items: end;
|
306 |
+
}
|
307 |
+
|
308 |
+
#txtimg_hr_finalres .resolution, #img2img_scale_resolution_preview .resolution{
|
309 |
+
font-weight: bold;
|
310 |
+
}
|
311 |
+
|
312 |
+
#txtimg_hr_finalres div.pending, #img2img_scale_resolution_preview div.pending {
|
313 |
+
opacity: 1;
|
314 |
+
transition: opacity 0s;
|
315 |
+
}
|
316 |
+
|
317 |
+
.inactive{
|
318 |
+
opacity: 0.5;
|
319 |
+
}
|
320 |
+
|
321 |
+
[id$=_column_batch]{
|
322 |
+
min-width: min(13.5em, 100%) !important;
|
323 |
+
}
|
324 |
+
|
325 |
+
div.dimensions-tools{
|
326 |
+
min-width: 0 !important;
|
327 |
+
max-width: fit-content;
|
328 |
+
flex-direction: column;
|
329 |
+
place-content: center;
|
330 |
+
}
|
331 |
+
|
332 |
+
div#extras_scale_to_tab div.form{
|
333 |
+
flex-direction: row;
|
334 |
+
}
|
335 |
+
|
336 |
+
#img2img_sketch, #img2maskimg, #inpaint_sketch {
|
337 |
+
overflow: overlay !important;
|
338 |
+
resize: auto;
|
339 |
+
background: var(--panel-background-fill);
|
340 |
+
z-index: 5;
|
341 |
+
}
|
342 |
+
|
343 |
+
.image-buttons button{
|
344 |
+
min-width: auto;
|
345 |
+
}
|
346 |
+
|
347 |
+
.infotext {
|
348 |
+
overflow-wrap: break-word;
|
349 |
+
}
|
350 |
+
|
351 |
+
#img2img_column_batch{
|
352 |
+
align-self: end;
|
353 |
+
margin-bottom: 0.9em;
|
354 |
+
}
|
355 |
+
|
356 |
+
#img2img_unused_scale_by_slider{
|
357 |
+
visibility: hidden;
|
358 |
+
width: 0.5em;
|
359 |
+
max-width: 0.5em;
|
360 |
+
min-width: 0.5em;
|
361 |
+
}
|
362 |
+
|
363 |
+
/* settings */
|
364 |
+
#quicksettings {
|
365 |
+
width: fit-content;
|
366 |
+
align-items: end;
|
367 |
+
}
|
368 |
+
|
369 |
+
#quicksettings > div, #quicksettings > fieldset{
|
370 |
+
max-width: 24em;
|
371 |
+
min-width: 24em;
|
372 |
+
padding: 0;
|
373 |
+
border: none;
|
374 |
+
box-shadow: none;
|
375 |
+
background: none;
|
376 |
+
}
|
377 |
+
|
378 |
+
#settings{
|
379 |
+
display: block;
|
380 |
+
}
|
381 |
+
|
382 |
+
#settings > div{
|
383 |
+
border: none;
|
384 |
+
margin-left: 10em;
|
385 |
+
}
|
386 |
+
|
387 |
+
#settings > div.tab-nav{
|
388 |
+
float: left;
|
389 |
+
display: block;
|
390 |
+
margin-left: 0;
|
391 |
+
width: 10em;
|
392 |
+
}
|
393 |
+
|
394 |
+
#settings > div.tab-nav button{
|
395 |
+
display: block;
|
396 |
+
border: none;
|
397 |
+
text-align: left;
|
398 |
+
white-space: initial;
|
399 |
+
}
|
400 |
+
|
401 |
+
#settings_result{
|
402 |
+
height: 1.4em;
|
403 |
+
margin: 0 1.2em;
|
404 |
+
}
|
405 |
+
|
406 |
+
table.settings-value-table{
|
407 |
+
background: white;
|
408 |
+
border-collapse: collapse;
|
409 |
+
margin: 1em;
|
410 |
+
border: 4px solid white;
|
411 |
+
}
|
412 |
+
|
413 |
+
table.settings-value-table td{
|
414 |
+
padding: 0.4em;
|
415 |
+
border: 1px solid #ccc;
|
416 |
+
max-width: 36em;
|
417 |
+
}
|
418 |
+
|
419 |
+
.ui-defaults-none{
|
420 |
+
color: #aaa !important;
|
421 |
+
}
|
422 |
+
|
423 |
+
#settings span{
|
424 |
+
color: var(--body-text-color);
|
425 |
+
}
|
426 |
+
|
427 |
+
#settings .gradio-textbox, #settings .gradio-slider, #settings .gradio-number, #settings .gradio-dropdown, #settings .gradio-checkboxgroup, #settings .gradio-radio{
|
428 |
+
margin-top: 0.75em;
|
429 |
+
}
|
430 |
+
|
431 |
+
#settings span .settings-comment {
|
432 |
+
display: inline
|
433 |
+
}
|
434 |
+
|
435 |
+
.settings-comment a{
|
436 |
+
text-decoration: underline;
|
437 |
+
}
|
438 |
+
|
439 |
+
.settings-comment .info{
|
440 |
+
opacity: 0.75;
|
441 |
+
}
|
442 |
+
|
443 |
+
/* live preview */
|
444 |
+
.progressDiv{
|
445 |
+
position: relative;
|
446 |
+
height: 20px;
|
447 |
+
background: #b4c0cc;
|
448 |
+
border-radius: 3px !important;
|
449 |
+
margin-bottom: -3px;
|
450 |
+
}
|
451 |
+
|
452 |
+
.dark .progressDiv{
|
453 |
+
background: #424c5b;
|
454 |
+
}
|
455 |
+
|
456 |
+
.progressDiv .progress{
|
457 |
+
width: 0%;
|
458 |
+
height: 20px;
|
459 |
+
background: #0060df;
|
460 |
+
color: white;
|
461 |
+
font-weight: bold;
|
462 |
+
line-height: 20px;
|
463 |
+
padding: 0 8px 0 0;
|
464 |
+
text-align: right;
|
465 |
+
border-radius: 3px;
|
466 |
+
overflow: visible;
|
467 |
+
white-space: nowrap;
|
468 |
+
padding: 0 0.5em;
|
469 |
+
}
|
470 |
+
|
471 |
+
.livePreview{
|
472 |
+
position: absolute;
|
473 |
+
z-index: 300;
|
474 |
+
background-color: white;
|
475 |
+
margin: -4px;
|
476 |
+
}
|
477 |
+
|
478 |
+
.dark .livePreview{
|
479 |
+
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
|
480 |
+
}
|
481 |
+
|
482 |
+
.livePreview img{
|
483 |
+
position: absolute;
|
484 |
+
object-fit: contain;
|
485 |
+
width: 100%;
|
486 |
+
height: 100%;
|
487 |
+
}
|
488 |
+
|
489 |
+
/* fullscreen popup (ie in Lora's (i) button) */
|
490 |
+
|
491 |
+
.popup-metadata{
|
492 |
+
color: black;
|
493 |
+
background: white;
|
494 |
+
display: inline-block;
|
495 |
+
padding: 1em;
|
496 |
+
white-space: pre-wrap;
|
497 |
+
}
|
498 |
+
|
499 |
+
.global-popup{
|
500 |
+
display: flex;
|
501 |
+
position: fixed;
|
502 |
+
z-index: 1001;
|
503 |
+
left: 0;
|
504 |
+
top: 0;
|
505 |
+
width: 100%;
|
506 |
+
height: 100%;
|
507 |
+
overflow: auto;
|
508 |
+
background-color: rgba(20, 20, 20, 0.95);
|
509 |
+
}
|
510 |
+
|
511 |
+
|
512 |
+
.global-popup-close:before {
|
513 |
+
content: "×";
|
514 |
+
}
|
515 |
+
|
516 |
+
.global-popup-close{
|
517 |
+
position: fixed;
|
518 |
+
right: 0.25em;
|
519 |
+
top: 0;
|
520 |
+
cursor: pointer;
|
521 |
+
color: white;
|
522 |
+
font-size: 32pt;
|
523 |
+
}
|
524 |
+
|
525 |
+
.global-popup-inner{
|
526 |
+
display: inline-block;
|
527 |
+
margin: auto;
|
528 |
+
padding: 2em;
|
529 |
+
}
|
530 |
+
|
531 |
+
/* fullpage image viewer */
|
532 |
+
|
533 |
+
#lightboxModal{
|
534 |
+
display: none;
|
535 |
+
position: fixed;
|
536 |
+
z-index: 1001;
|
537 |
+
left: 0;
|
538 |
+
top: 0;
|
539 |
+
width: 100%;
|
540 |
+
height: 100%;
|
541 |
+
overflow: auto;
|
542 |
+
background-color: rgba(20, 20, 20, 0.95);
|
543 |
+
user-select: none;
|
544 |
+
-webkit-user-select: none;
|
545 |
+
flex-direction: column;
|
546 |
+
}
|
547 |
+
|
548 |
+
.modalControls {
|
549 |
+
display: flex;
|
550 |
+
gap: 1em;
|
551 |
+
padding: 1em;
|
552 |
+
background-color: rgba(0,0,0,0.2);
|
553 |
+
}
|
554 |
+
.modalClose {
|
555 |
+
margin-left: auto;
|
556 |
+
}
|
557 |
+
.modalControls span{
|
558 |
+
color: white;
|
559 |
+
font-size: 35px;
|
560 |
+
font-weight: bold;
|
561 |
+
cursor: pointer;
|
562 |
+
width: 1em;
|
563 |
+
}
|
564 |
+
|
565 |
+
.modalControls span:hover, .modalControls span:focus{
|
566 |
+
color: #999;
|
567 |
+
text-decoration: none;
|
568 |
+
}
|
569 |
+
|
570 |
+
#lightboxModal > img {
|
571 |
+
display: block;
|
572 |
+
margin: auto;
|
573 |
+
width: auto;
|
574 |
+
}
|
575 |
+
|
576 |
+
#lightboxModal > img.modalImageFullscreen{
|
577 |
+
object-fit: contain;
|
578 |
+
height: 100%;
|
579 |
+
width: 100%;
|
580 |
+
min-height: 0;
|
581 |
+
}
|
582 |
+
|
583 |
+
.modalPrev,
|
584 |
+
.modalNext {
|
585 |
+
cursor: pointer;
|
586 |
+
position: absolute;
|
587 |
+
top: 50%;
|
588 |
+
width: auto;
|
589 |
+
padding: 16px;
|
590 |
+
margin-top: -50px;
|
591 |
+
color: white;
|
592 |
+
font-weight: bold;
|
593 |
+
font-size: 20px;
|
594 |
+
transition: 0.6s ease;
|
595 |
+
border-radius: 0 3px 3px 0;
|
596 |
+
user-select: none;
|
597 |
+
-webkit-user-select: none;
|
598 |
+
}
|
599 |
+
|
600 |
+
.modalNext {
|
601 |
+
right: 0;
|
602 |
+
border-radius: 3px 0 0 3px;
|
603 |
+
}
|
604 |
+
|
605 |
+
.modalPrev:hover,
|
606 |
+
.modalNext:hover {
|
607 |
+
background-color: rgba(0, 0, 0, 0.8);
|
608 |
+
}
|
609 |
+
|
610 |
+
#imageARPreview {
|
611 |
+
position: absolute;
|
612 |
+
top: 0px;
|
613 |
+
left: 0px;
|
614 |
+
border: 2px solid red;
|
615 |
+
background: rgba(255, 0, 0, 0.3);
|
616 |
+
z-index: 900;
|
617 |
+
pointer-events: none;
|
618 |
+
display: none;
|
619 |
+
}
|
620 |
+
|
621 |
+
/* context menu (ie for the generate button) */
|
622 |
+
|
623 |
+
#context-menu{
|
624 |
+
z-index:9999;
|
625 |
+
position:absolute;
|
626 |
+
display:block;
|
627 |
+
padding:0px 0;
|
628 |
+
border:2px solid #a55000;
|
629 |
+
border-radius:8px;
|
630 |
+
box-shadow:1px 1px 2px #CE6400;
|
631 |
+
width: 200px;
|
632 |
+
}
|
633 |
+
|
634 |
+
.context-menu-items{
|
635 |
+
list-style: none;
|
636 |
+
margin: 0;
|
637 |
+
padding: 0;
|
638 |
+
}
|
639 |
+
|
640 |
+
.context-menu-items a{
|
641 |
+
display:block;
|
642 |
+
padding:5px;
|
643 |
+
cursor:pointer;
|
644 |
+
}
|
645 |
+
|
646 |
+
.context-menu-items a:hover{
|
647 |
+
background: #a55000;
|
648 |
+
}
|
649 |
+
|
650 |
+
|
651 |
+
/* extensions */
|
652 |
+
|
653 |
+
#tab_extensions table{
|
654 |
+
border-collapse: collapse;
|
655 |
+
}
|
656 |
+
|
657 |
+
#tab_extensions table td, #tab_extensions table th{
|
658 |
+
border: 1px solid #ccc;
|
659 |
+
padding: 0.25em 0.5em;
|
660 |
+
}
|
661 |
+
|
662 |
+
#tab_extensions table input[type="checkbox"]{
|
663 |
+
margin-right: 0.5em;
|
664 |
+
appearance: checkbox;
|
665 |
+
}
|
666 |
+
|
667 |
+
#tab_extensions button{
|
668 |
+
max-width: 16em;
|
669 |
+
}
|
670 |
+
|
671 |
+
#tab_extensions input[disabled="disabled"]{
|
672 |
+
opacity: 0.5;
|
673 |
+
}
|
674 |
+
|
675 |
+
.extension-tag{
|
676 |
+
font-weight: bold;
|
677 |
+
font-size: 95%;
|
678 |
+
}
|
679 |
+
|
680 |
+
#available_extensions .info{
|
681 |
+
margin: 0;
|
682 |
+
}
|
683 |
+
|
684 |
+
#available_extensions .date_added{
|
685 |
+
opacity: 0.85;
|
686 |
+
font-size: 90%;
|
687 |
+
}
|
688 |
+
|
689 |
+
/* replace original footer with ours */
|
690 |
+
|
691 |
+
footer {
|
692 |
+
display: none !important;
|
693 |
+
}
|
694 |
+
|
695 |
+
#footer{
|
696 |
+
text-align: center;
|
697 |
+
}
|
698 |
+
|
699 |
+
#footer div{
|
700 |
+
display: inline-block;
|
701 |
+
}
|
702 |
+
|
703 |
+
#footer .versions{
|
704 |
+
font-size: 85%;
|
705 |
+
opacity: 0.85;
|
706 |
+
}
|
707 |
+
|
708 |
+
/* extra networks UI */
|
709 |
+
|
710 |
+
.extra-network-cards{
|
711 |
+
height: 725px;
|
712 |
+
overflow: scroll;
|
713 |
+
resize: vertical;
|
714 |
+
}
|
715 |
+
|
716 |
+
.extra-networks > div > [id *= '_extra_']{
|
717 |
+
margin: 0.3em;
|
718 |
+
}
|
719 |
+
|
720 |
+
.extra-network-subdirs{
|
721 |
+
padding: 0.2em 0.35em;
|
722 |
+
}
|
723 |
+
|
724 |
+
.extra-network-subdirs button{
|
725 |
+
margin: 0 0.15em;
|
726 |
+
}
|
727 |
+
.extra-networks .tab-nav .search{
|
728 |
+
display: inline-block;
|
729 |
+
max-width: 16em;
|
730 |
+
margin: 0.3em;
|
731 |
+
align-self: center;
|
732 |
+
width: 16em;
|
733 |
+
}
|
734 |
+
|
735 |
+
#txt2img_extra_view, #img2img_extra_view {
|
736 |
+
width: auto;
|
737 |
+
}
|
738 |
+
|
739 |
+
.extra-network-cards .nocards, .extra-network-thumbs .nocards{
|
740 |
+
margin: 1.25em 0.5em 0.5em 0.5em;
|
741 |
+
}
|
742 |
+
|
743 |
+
.extra-network-cards .nocards h1, .extra-network-thumbs .nocards h1{
|
744 |
+
font-size: 1.5em;
|
745 |
+
margin-bottom: 1em;
|
746 |
+
}
|
747 |
+
|
748 |
+
.extra-network-cards .nocards li, .extra-network-thumbs .nocards li{
|
749 |
+
margin-left: 0.5em;
|
750 |
+
}
|
751 |
+
|
752 |
+
|
753 |
+
.extra-network-cards .card .metadata-button:before, .extra-network-thumbs .card .metadata-button:before{
|
754 |
+
content: "🛈";
|
755 |
+
}
|
756 |
+
.extra-network-cards .card .metadata-button, .extra-network-thumbs .card .metadata-button{
|
757 |
+
display: none;
|
758 |
+
position: absolute;
|
759 |
+
color: white;
|
760 |
+
right: 0;
|
761 |
+
}
|
762 |
+
.extra-network-cards .card .metadata-button {
|
763 |
+
text-shadow: 2px 2px 3px black;
|
764 |
+
padding: 0.25em;
|
765 |
+
font-size: 22pt;
|
766 |
+
width: 1.5em;
|
767 |
+
}
|
768 |
+
.extra-network-thumbs .card .metadata-button {
|
769 |
+
text-shadow: 1px 1px 2px black;
|
770 |
+
padding: 0;
|
771 |
+
font-size: 16pt;
|
772 |
+
width: 1em;
|
773 |
+
top: -0.25em;
|
774 |
+
}
|
775 |
+
.extra-network-cards .card:hover .metadata-button, .extra-network-thumbs .card:hover .metadata-button{
|
776 |
+
display: inline-block;
|
777 |
+
}
|
778 |
+
.extra-network-cards .card .metadata-button:hover, .extra-network-thumbs .card .metadata-button:hover{
|
779 |
+
color: red;
|
780 |
+
}
|
781 |
+
|
782 |
+
|
783 |
+
.extra-network-thumbs {
|
784 |
+
display: flex;
|
785 |
+
flex-flow: row wrap;
|
786 |
+
gap: 10px;
|
787 |
+
}
|
788 |
+
|
789 |
+
.extra-network-thumbs .card {
|
790 |
+
height: 6em;
|
791 |
+
width: 6em;
|
792 |
+
cursor: pointer;
|
793 |
+
background-image: url('./file=html/card-no-preview.png');
|
794 |
+
background-size: cover;
|
795 |
+
background-position: center center;
|
796 |
+
position: relative;
|
797 |
+
}
|
798 |
+
|
799 |
+
.extra-network-thumbs .card .preview{
|
800 |
+
position: absolute;
|
801 |
+
object-fit: cover;
|
802 |
+
width: 100%;
|
803 |
+
height:100%;
|
804 |
+
}
|
805 |
+
|
806 |
+
.extra-network-thumbs .card:hover .additional a {
|
807 |
+
display: inline-block;
|
808 |
+
}
|
809 |
+
|
810 |
+
.extra-network-thumbs .actions .additional a {
|
811 |
+
background-image: url('./file=html/image-update.svg');
|
812 |
+
background-repeat: no-repeat;
|
813 |
+
background-size: cover;
|
814 |
+
background-position: center center;
|
815 |
+
position: absolute;
|
816 |
+
top: 0;
|
817 |
+
left: 0;
|
818 |
+
width: 24px;
|
819 |
+
height: 24px;
|
820 |
+
display: none;
|
821 |
+
font-size: 0;
|
822 |
+
text-align: -9999;
|
823 |
+
}
|
824 |
+
|
825 |
+
.extra-network-thumbs .actions .name {
|
826 |
+
position: absolute;
|
827 |
+
bottom: 0;
|
828 |
+
font-size: 10px;
|
829 |
+
padding: 3px;
|
830 |
+
width: 100%;
|
831 |
+
overflow: hidden;
|
832 |
+
white-space: nowrap;
|
833 |
+
text-overflow: ellipsis;
|
834 |
+
background: rgba(0,0,0,.5);
|
835 |
+
color: white;
|
836 |
+
}
|
837 |
+
|
838 |
+
.extra-network-thumbs .card:hover .actions .name {
|
839 |
+
white-space: normal;
|
840 |
+
word-break: break-all;
|
841 |
+
}
|
842 |
+
|
843 |
+
.extra-network-cards .card{
|
844 |
+
display: inline-block;
|
845 |
+
margin: 0.5em;
|
846 |
+
width: 16em;
|
847 |
+
height: 24em;
|
848 |
+
box-shadow: 0 0 5px rgba(128, 128, 128, 0.5);
|
849 |
+
border-radius: 0.2em;
|
850 |
+
position: relative;
|
851 |
+
|
852 |
+
background-size: auto 100%;
|
853 |
+
background-position: center;
|
854 |
+
overflow: hidden;
|
855 |
+
cursor: pointer;
|
856 |
+
|
857 |
+
background-image: url('./file=html/card-no-preview.png')
|
858 |
+
}
|
859 |
+
|
860 |
+
.extra-network-cards .card:hover{
|
861 |
+
box-shadow: 0 0 2px 0.3em rgba(0, 128, 255, 0.35);
|
862 |
+
}
|
863 |
+
|
864 |
+
.extra-network-cards .card .actions .additional{
|
865 |
+
display: none;
|
866 |
+
}
|
867 |
+
|
868 |
+
.extra-network-cards .card .actions{
|
869 |
+
position: absolute;
|
870 |
+
bottom: 0;
|
871 |
+
left: 0;
|
872 |
+
right: 0;
|
873 |
+
padding: 0.5em;
|
874 |
+
background: rgba(0,0,0,0.5);
|
875 |
+
box-shadow: 0 0 0.25em 0.25em rgba(0,0,0,0.5);
|
876 |
+
text-shadow: 0 0 0.2em black;
|
877 |
+
}
|
878 |
+
|
879 |
+
.extra-network-cards .card .actions *{
|
880 |
+
color: white;
|
881 |
+
}
|
882 |
+
|
883 |
+
.extra-network-cards .card .actions:hover{
|
884 |
+
box-shadow: 0 0 0.75em 0.75em rgba(0,0,0,0.5) !important;
|
885 |
+
}
|
886 |
+
|
887 |
+
.extra-network-cards .card .actions .name{
|
888 |
+
font-size: 1.7em;
|
889 |
+
font-weight: bold;
|
890 |
+
line-break: anywhere;
|
891 |
+
}
|
892 |
+
|
893 |
+
.extra-network-cards .card .actions .description {
|
894 |
+
display: block;
|
895 |
+
max-height: 3em;
|
896 |
+
white-space: pre-wrap;
|
897 |
+
line-height: 1.1;
|
898 |
+
}
|
899 |
+
|
900 |
+
.extra-network-cards .card .actions .description:hover {
|
901 |
+
max-height: none;
|
902 |
+
}
|
903 |
+
|
904 |
+
.extra-network-cards .card .actions:hover .additional{
|
905 |
+
display: block;
|
906 |
+
}
|
907 |
+
|
908 |
+
.extra-network-cards .card ul{
|
909 |
+
margin: 0.25em 0 0.75em 0.25em;
|
910 |
+
cursor: unset;
|
911 |
+
}
|
912 |
+
|
913 |
+
.extra-network-cards .card ul a{
|
914 |
+
cursor: pointer;
|
915 |
+
}
|
916 |
+
|
917 |
+
.extra-network-cards .card ul a:hover{
|
918 |
+
color: red;
|
919 |
+
}
|
920 |
+
|
921 |
+
.extra-network-cards .card .preview{
|
922 |
+
position: absolute;
|
923 |
+
object-fit: cover;
|
924 |
+
width: 100%;
|
925 |
+
height:100%;
|
926 |
+
}
|
webui-macos-env.sh
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
####################################################################
|
3 |
+
# macOS defaults #
|
4 |
+
# Please modify webui-user.sh to change these instead of this file #
|
5 |
+
####################################################################
|
6 |
+
|
7 |
+
if [[ -x "$(command -v python3.10)" ]]
|
8 |
+
then
|
9 |
+
python_cmd="python3.10"
|
10 |
+
fi
|
11 |
+
|
12 |
+
export install_dir="$HOME"
|
13 |
+
export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate"
|
14 |
+
export TORCH_COMMAND="pip install torch==2.0.1 torchvision==0.15.2"
|
15 |
+
export K_DIFFUSION_REPO="https://github.com/brkirch/k-diffusion.git"
|
16 |
+
export K_DIFFUSION_COMMIT_HASH="51c9778f269cedb55a4d88c79c0246d35bdadb71"
|
17 |
+
export PYTORCH_ENABLE_MPS_FALLBACK=1
|
18 |
+
|
19 |
+
####################################################################
|
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,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Uncomment to enable accelerated launch
|
44 |
+
#export ACCELERATE="True"
|
45 |
+
|
46 |
+
# Uncomment to disable TCMalloc
|
47 |
+
#export NO_TCMALLOC="True"
|
48 |
+
|
49 |
+
###########################################
|
webui.bat
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
|
3 |
+
if not defined PYTHON (set PYTHON=python)
|
4 |
+
if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv")
|
5 |
+
|
6 |
+
|
7 |
+
set ERROR_REPORTING=FALSE
|
8 |
+
|
9 |
+
mkdir tmp 2>NUL
|
10 |
+
|
11 |
+
%PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt
|
12 |
+
if %ERRORLEVEL% == 0 goto :check_pip
|
13 |
+
echo Couldn't launch python
|
14 |
+
goto :show_stdout_stderr
|
15 |
+
|
16 |
+
:check_pip
|
17 |
+
%PYTHON% -mpip --help >tmp/stdout.txt 2>tmp/stderr.txt
|
18 |
+
if %ERRORLEVEL% == 0 goto :start_venv
|
19 |
+
if "%PIP_INSTALLER_LOCATION%" == "" goto :show_stdout_stderr
|
20 |
+
%PYTHON% "%PIP_INSTALLER_LOCATION%" >tmp/stdout.txt 2>tmp/stderr.txt
|
21 |
+
if %ERRORLEVEL% == 0 goto :start_venv
|
22 |
+
echo Couldn't install pip
|
23 |
+
goto :show_stdout_stderr
|
24 |
+
|
25 |
+
:start_venv
|
26 |
+
if ["%VENV_DIR%"] == ["-"] goto :skip_venv
|
27 |
+
if ["%SKIP_VENV%"] == ["1"] goto :skip_venv
|
28 |
+
|
29 |
+
dir "%VENV_DIR%\Scripts\Python.exe" >tmp/stdout.txt 2>tmp/stderr.txt
|
30 |
+
if %ERRORLEVEL% == 0 goto :activate_venv
|
31 |
+
|
32 |
+
for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"
|
33 |
+
echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%
|
34 |
+
%PYTHON_FULLNAME% -m venv "%VENV_DIR%" >tmp/stdout.txt 2>tmp/stderr.txt
|
35 |
+
if %ERRORLEVEL% == 0 goto :activate_venv
|
36 |
+
echo Unable to create venv in directory "%VENV_DIR%"
|
37 |
+
goto :show_stdout_stderr
|
38 |
+
|
39 |
+
:activate_venv
|
40 |
+
set PYTHON="%VENV_DIR%\Scripts\Python.exe"
|
41 |
+
echo venv %PYTHON%
|
42 |
+
|
43 |
+
:skip_venv
|
44 |
+
if [%ACCELERATE%] == ["True"] goto :accelerate
|
45 |
+
goto :launch
|
46 |
+
|
47 |
+
:accelerate
|
48 |
+
echo Checking for accelerate
|
49 |
+
set ACCELERATE="%VENV_DIR%\Scripts\accelerate.exe"
|
50 |
+
if EXIST %ACCELERATE% goto :accelerate_launch
|
51 |
+
|
52 |
+
:launch
|
53 |
+
%PYTHON% launch.py %*
|
54 |
+
pause
|
55 |
+
exit /b
|
56 |
+
|
57 |
+
:accelerate_launch
|
58 |
+
echo Accelerating
|
59 |
+
%ACCELERATE% launch --num_cpu_threads_per_process=6 launch.py
|
60 |
+
pause
|
61 |
+
exit /b
|
62 |
+
|
63 |
+
:show_stdout_stderr
|
64 |
+
|
65 |
+
echo.
|
66 |
+
echo exit code: %errorlevel%
|
67 |
+
|
68 |
+
for /f %%i in ("tmp\stdout.txt") do set size=%%~zi
|
69 |
+
if %size% equ 0 goto :show_stderr
|
70 |
+
echo.
|
71 |
+
echo stdout:
|
72 |
+
type tmp\stdout.txt
|
73 |
+
|
74 |
+
:show_stderr
|
75 |
+
for /f %%i in ("tmp\stderr.txt") do set size=%%~zi
|
76 |
+
if %size% equ 0 goto :show_stderr
|
77 |
+
echo.
|
78 |
+
echo stderr:
|
79 |
+
type tmp\stderr.txt
|
80 |
+
|
81 |
+
:endofscript
|
82 |
+
|
83 |
+
echo.
|
84 |
+
echo Launch unsuccessful. Exiting.
|
85 |
+
pause
|
webui.py
ADDED
@@ -0,0 +1,478 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import os
|
4 |
+
import sys
|
5 |
+
import time
|
6 |
+
import importlib
|
7 |
+
import signal
|
8 |
+
import re
|
9 |
+
import warnings
|
10 |
+
import json
|
11 |
+
from threading import Thread
|
12 |
+
from typing import Iterable
|
13 |
+
|
14 |
+
from fastapi import FastAPI, Response
|
15 |
+
from fastapi.middleware.cors import CORSMiddleware
|
16 |
+
from fastapi.middleware.gzip import GZipMiddleware
|
17 |
+
from packaging import version
|
18 |
+
|
19 |
+
import logging
|
20 |
+
|
21 |
+
logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())
|
22 |
+
|
23 |
+
from modules import paths, timer, import_hook, errors # noqa: F401
|
24 |
+
|
25 |
+
startup_timer = timer.Timer()
|
26 |
+
|
27 |
+
import torch
|
28 |
+
import pytorch_lightning # noqa: F401 # pytorch_lightning should be imported after torch, but it re-enables warnings on import so import once to disable them
|
29 |
+
warnings.filterwarnings(action="ignore", category=DeprecationWarning, module="pytorch_lightning")
|
30 |
+
warnings.filterwarnings(action="ignore", category=UserWarning, module="torchvision")
|
31 |
+
|
32 |
+
|
33 |
+
startup_timer.record("import torch")
|
34 |
+
|
35 |
+
import gradio
|
36 |
+
startup_timer.record("import gradio")
|
37 |
+
|
38 |
+
import ldm.modules.encoders.modules # noqa: F401
|
39 |
+
startup_timer.record("import ldm")
|
40 |
+
|
41 |
+
from modules import extra_networks
|
42 |
+
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, queue_lock # noqa: F401
|
43 |
+
|
44 |
+
# Truncate version number of nightly/local build of PyTorch to not cause exceptions with CodeFormer or Safetensors
|
45 |
+
if ".dev" in torch.__version__ or "+git" in torch.__version__:
|
46 |
+
torch.__long_version__ = torch.__version__
|
47 |
+
torch.__version__ = re.search(r'[\d.]+[\d]', torch.__version__).group(0)
|
48 |
+
|
49 |
+
from modules import shared, sd_samplers, upscaler, extensions, localization, ui_tempdir, ui_extra_networks, config_states
|
50 |
+
import modules.codeformer_model as codeformer
|
51 |
+
import modules.face_restoration
|
52 |
+
import modules.gfpgan_model as gfpgan
|
53 |
+
import modules.img2img
|
54 |
+
|
55 |
+
import modules.lowvram
|
56 |
+
import modules.scripts
|
57 |
+
import modules.sd_hijack
|
58 |
+
import modules.sd_hijack_optimizations
|
59 |
+
import modules.sd_models
|
60 |
+
import modules.sd_vae
|
61 |
+
import modules.txt2img
|
62 |
+
import modules.script_callbacks
|
63 |
+
import modules.textual_inversion.textual_inversion
|
64 |
+
import modules.progress
|
65 |
+
|
66 |
+
import modules.ui
|
67 |
+
from modules import modelloader
|
68 |
+
from modules.shared import cmd_opts
|
69 |
+
import modules.hypernetworks.hypernetwork
|
70 |
+
|
71 |
+
startup_timer.record("other imports")
|
72 |
+
|
73 |
+
|
74 |
+
if cmd_opts.server_name:
|
75 |
+
server_name = cmd_opts.server_name
|
76 |
+
else:
|
77 |
+
server_name = "0.0.0.0" if cmd_opts.listen else None
|
78 |
+
|
79 |
+
|
80 |
+
def fix_asyncio_event_loop_policy():
|
81 |
+
"""
|
82 |
+
The default `asyncio` event loop policy only automatically creates
|
83 |
+
event loops in the main threads. Other threads must create event
|
84 |
+
loops explicitly or `asyncio.get_event_loop` (and therefore
|
85 |
+
`.IOLoop.current`) will fail. Installing this policy allows event
|
86 |
+
loops to be created automatically on any thread, matching the
|
87 |
+
behavior of Tornado versions prior to 5.0 (or 5.0 on Python 2).
|
88 |
+
"""
|
89 |
+
|
90 |
+
import asyncio
|
91 |
+
|
92 |
+
if sys.platform == "win32" and hasattr(asyncio, "WindowsSelectorEventLoopPolicy"):
|
93 |
+
# "Any thread" and "selector" should be orthogonal, but there's not a clean
|
94 |
+
# interface for composing policies so pick the right base.
|
95 |
+
_BasePolicy = asyncio.WindowsSelectorEventLoopPolicy # type: ignore
|
96 |
+
else:
|
97 |
+
_BasePolicy = asyncio.DefaultEventLoopPolicy
|
98 |
+
|
99 |
+
class AnyThreadEventLoopPolicy(_BasePolicy): # type: ignore
|
100 |
+
"""Event loop policy that allows loop creation on any thread.
|
101 |
+
Usage::
|
102 |
+
|
103 |
+
asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())
|
104 |
+
"""
|
105 |
+
|
106 |
+
def get_event_loop(self) -> asyncio.AbstractEventLoop:
|
107 |
+
try:
|
108 |
+
return super().get_event_loop()
|
109 |
+
except (RuntimeError, AssertionError):
|
110 |
+
# This was an AssertionError in python 3.4.2 (which ships with debian jessie)
|
111 |
+
# and changed to a RuntimeError in 3.4.3.
|
112 |
+
# "There is no current event loop in thread %r"
|
113 |
+
loop = self.new_event_loop()
|
114 |
+
self.set_event_loop(loop)
|
115 |
+
return loop
|
116 |
+
|
117 |
+
asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())
|
118 |
+
|
119 |
+
|
120 |
+
def check_versions():
|
121 |
+
if shared.cmd_opts.skip_version_check:
|
122 |
+
return
|
123 |
+
|
124 |
+
expected_torch_version = "2.0.0"
|
125 |
+
|
126 |
+
if version.parse(torch.__version__) < version.parse(expected_torch_version):
|
127 |
+
errors.print_error_explanation(f"""
|
128 |
+
You are running torch {torch.__version__}.
|
129 |
+
The program is tested to work with torch {expected_torch_version}.
|
130 |
+
To reinstall the desired version, run with commandline flag --reinstall-torch.
|
131 |
+
Beware that this will cause a lot of large files to be downloaded, as well as
|
132 |
+
there are reports of issues with training tab on the latest version.
|
133 |
+
|
134 |
+
Use --skip-version-check commandline argument to disable this check.
|
135 |
+
""".strip())
|
136 |
+
|
137 |
+
expected_xformers_version = "0.0.17"
|
138 |
+
if shared.xformers_available:
|
139 |
+
import xformers
|
140 |
+
|
141 |
+
if version.parse(xformers.__version__) < version.parse(expected_xformers_version):
|
142 |
+
errors.print_error_explanation(f"""
|
143 |
+
You are running xformers {xformers.__version__}.
|
144 |
+
The program is tested to work with xformers {expected_xformers_version}.
|
145 |
+
To reinstall the desired version, run with commandline flag --reinstall-xformers.
|
146 |
+
|
147 |
+
Use --skip-version-check commandline argument to disable this check.
|
148 |
+
""".strip())
|
149 |
+
|
150 |
+
|
151 |
+
def restore_config_state_file():
|
152 |
+
config_state_file = shared.opts.restore_config_state_file
|
153 |
+
if config_state_file == "":
|
154 |
+
return
|
155 |
+
|
156 |
+
shared.opts.restore_config_state_file = ""
|
157 |
+
shared.opts.save(shared.config_filename)
|
158 |
+
|
159 |
+
if os.path.isfile(config_state_file):
|
160 |
+
print(f"*** About to restore extension state from file: {config_state_file}")
|
161 |
+
with open(config_state_file, "r", encoding="utf-8") as f:
|
162 |
+
config_state = json.load(f)
|
163 |
+
config_states.restore_extension_config(config_state)
|
164 |
+
startup_timer.record("restore extension config")
|
165 |
+
elif config_state_file:
|
166 |
+
print(f"!!! Config state backup not found: {config_state_file}")
|
167 |
+
|
168 |
+
|
169 |
+
def validate_tls_options():
|
170 |
+
if not (cmd_opts.tls_keyfile and cmd_opts.tls_certfile):
|
171 |
+
return
|
172 |
+
|
173 |
+
try:
|
174 |
+
if not os.path.exists(cmd_opts.tls_keyfile):
|
175 |
+
print("Invalid path to TLS keyfile given")
|
176 |
+
if not os.path.exists(cmd_opts.tls_certfile):
|
177 |
+
print(f"Invalid path to TLS certfile: '{cmd_opts.tls_certfile}'")
|
178 |
+
except TypeError:
|
179 |
+
cmd_opts.tls_keyfile = cmd_opts.tls_certfile = None
|
180 |
+
print("TLS setup invalid, running webui without TLS")
|
181 |
+
else:
|
182 |
+
print("Running with TLS")
|
183 |
+
startup_timer.record("TLS")
|
184 |
+
|
185 |
+
|
186 |
+
def get_gradio_auth_creds() -> Iterable[tuple[str, ...]]:
|
187 |
+
"""
|
188 |
+
Convert the gradio_auth and gradio_auth_path commandline arguments into
|
189 |
+
an iterable of (username, password) tuples.
|
190 |
+
"""
|
191 |
+
def process_credential_line(s) -> tuple[str, ...] | None:
|
192 |
+
s = s.strip()
|
193 |
+
if not s:
|
194 |
+
return None
|
195 |
+
return tuple(s.split(':', 1))
|
196 |
+
|
197 |
+
if cmd_opts.gradio_auth:
|
198 |
+
for cred in cmd_opts.gradio_auth.split(','):
|
199 |
+
cred = process_credential_line(cred)
|
200 |
+
if cred:
|
201 |
+
yield cred
|
202 |
+
|
203 |
+
if cmd_opts.gradio_auth_path:
|
204 |
+
with open(cmd_opts.gradio_auth_path, 'r', encoding="utf8") as file:
|
205 |
+
for line in file.readlines():
|
206 |
+
for cred in line.strip().split(','):
|
207 |
+
cred = process_credential_line(cred)
|
208 |
+
if cred:
|
209 |
+
yield cred
|
210 |
+
|
211 |
+
|
212 |
+
def configure_sigint_handler():
|
213 |
+
# make the program just exit at ctrl+c without waiting for anything
|
214 |
+
def sigint_handler(sig, frame):
|
215 |
+
print(f'Interrupted with signal {sig} in {frame}')
|
216 |
+
os._exit(0)
|
217 |
+
|
218 |
+
if not os.environ.get("COVERAGE_RUN"):
|
219 |
+
# Don't install the immediate-quit handler when running under coverage,
|
220 |
+
# as then the coverage report won't be generated.
|
221 |
+
signal.signal(signal.SIGINT, sigint_handler)
|
222 |
+
|
223 |
+
|
224 |
+
def configure_opts_onchange():
|
225 |
+
shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights()), call=False)
|
226 |
+
shared.opts.onchange("sd_vae", wrap_queued_call(lambda: modules.sd_vae.reload_vae_weights()), call=False)
|
227 |
+
shared.opts.onchange("sd_vae_as_default", wrap_queued_call(lambda: modules.sd_vae.reload_vae_weights()), call=False)
|
228 |
+
shared.opts.onchange("temp_dir", ui_tempdir.on_tmpdir_changed)
|
229 |
+
shared.opts.onchange("gradio_theme", shared.reload_gradio_theme)
|
230 |
+
shared.opts.onchange("cross_attention_optimization", wrap_queued_call(lambda: modules.sd_hijack.model_hijack.redo_hijack(shared.sd_model)), call=False)
|
231 |
+
startup_timer.record("opts onchange")
|
232 |
+
|
233 |
+
|
234 |
+
def initialize():
|
235 |
+
fix_asyncio_event_loop_policy()
|
236 |
+
validate_tls_options()
|
237 |
+
configure_sigint_handler()
|
238 |
+
check_versions()
|
239 |
+
modelloader.cleanup_models()
|
240 |
+
configure_opts_onchange()
|
241 |
+
|
242 |
+
modules.sd_models.setup_model()
|
243 |
+
startup_timer.record("setup SD model")
|
244 |
+
|
245 |
+
codeformer.setup_model(cmd_opts.codeformer_models_path)
|
246 |
+
startup_timer.record("setup codeformer")
|
247 |
+
|
248 |
+
gfpgan.setup_model(cmd_opts.gfpgan_models_path)
|
249 |
+
startup_timer.record("setup gfpgan")
|
250 |
+
|
251 |
+
initialize_rest(reload_script_modules=False)
|
252 |
+
|
253 |
+
|
254 |
+
def initialize_rest(*, reload_script_modules=False):
|
255 |
+
"""
|
256 |
+
Called both from initialize() and when reloading the webui.
|
257 |
+
"""
|
258 |
+
sd_samplers.set_samplers()
|
259 |
+
extensions.list_extensions()
|
260 |
+
startup_timer.record("list extensions")
|
261 |
+
|
262 |
+
restore_config_state_file()
|
263 |
+
|
264 |
+
if cmd_opts.ui_debug_mode:
|
265 |
+
shared.sd_upscalers = upscaler.UpscalerLanczos().scalers
|
266 |
+
modules.scripts.load_scripts()
|
267 |
+
return
|
268 |
+
|
269 |
+
modules.sd_models.list_models()
|
270 |
+
startup_timer.record("list SD models")
|
271 |
+
|
272 |
+
localization.list_localizations(cmd_opts.localizations_dir)
|
273 |
+
|
274 |
+
modules.scripts.load_scripts()
|
275 |
+
startup_timer.record("load scripts")
|
276 |
+
|
277 |
+
if reload_script_modules:
|
278 |
+
for module in [module for name, module in sys.modules.items() if name.startswith("modules.ui")]:
|
279 |
+
importlib.reload(module)
|
280 |
+
startup_timer.record("reload script modules")
|
281 |
+
|
282 |
+
modelloader.load_upscalers()
|
283 |
+
startup_timer.record("load upscalers")
|
284 |
+
|
285 |
+
modules.sd_vae.refresh_vae_list()
|
286 |
+
startup_timer.record("refresh VAE")
|
287 |
+
modules.textual_inversion.textual_inversion.list_textual_inversion_templates()
|
288 |
+
startup_timer.record("refresh textual inversion templates")
|
289 |
+
|
290 |
+
modules.script_callbacks.on_list_optimizers(modules.sd_hijack_optimizations.list_optimizers)
|
291 |
+
modules.sd_hijack.list_optimizers()
|
292 |
+
startup_timer.record("scripts list_optimizers")
|
293 |
+
|
294 |
+
def load_model():
|
295 |
+
"""
|
296 |
+
Accesses shared.sd_model property to load model.
|
297 |
+
After it's available, if it has been loaded before this access by some extension,
|
298 |
+
its optimization may be None because the list of optimizaers has neet been filled
|
299 |
+
by that time, so we apply optimization again.
|
300 |
+
"""
|
301 |
+
|
302 |
+
shared.sd_model # noqa: B018
|
303 |
+
|
304 |
+
if modules.sd_hijack.current_optimizer is None:
|
305 |
+
modules.sd_hijack.apply_optimizations()
|
306 |
+
|
307 |
+
Thread(target=load_model).start()
|
308 |
+
|
309 |
+
shared.reload_hypernetworks()
|
310 |
+
startup_timer.record("reload hypernetworks")
|
311 |
+
|
312 |
+
ui_extra_networks.initialize()
|
313 |
+
ui_extra_networks.register_default_pages()
|
314 |
+
|
315 |
+
extra_networks.initialize()
|
316 |
+
extra_networks.register_default_extra_networks()
|
317 |
+
startup_timer.record("initialize extra networks")
|
318 |
+
|
319 |
+
|
320 |
+
def setup_middleware(app):
|
321 |
+
app.middleware_stack = None # reset current middleware to allow modifying user provided list
|
322 |
+
app.add_middleware(GZipMiddleware, minimum_size=1000)
|
323 |
+
configure_cors_middleware(app)
|
324 |
+
app.build_middleware_stack() # rebuild middleware stack on-the-fly
|
325 |
+
|
326 |
+
|
327 |
+
def configure_cors_middleware(app):
|
328 |
+
cors_options = {
|
329 |
+
"allow_methods": ["*"],
|
330 |
+
"allow_headers": ["*"],
|
331 |
+
"allow_credentials": True,
|
332 |
+
}
|
333 |
+
if cmd_opts.cors_allow_origins:
|
334 |
+
cors_options["allow_origins"] = cmd_opts.cors_allow_origins.split(',')
|
335 |
+
if cmd_opts.cors_allow_origins_regex:
|
336 |
+
cors_options["allow_origin_regex"] = cmd_opts.cors_allow_origins_regex
|
337 |
+
app.add_middleware(CORSMiddleware, **cors_options)
|
338 |
+
|
339 |
+
|
340 |
+
def create_api(app):
|
341 |
+
from modules.api.api import Api
|
342 |
+
api = Api(app, queue_lock)
|
343 |
+
return api
|
344 |
+
|
345 |
+
|
346 |
+
def api_only():
|
347 |
+
initialize()
|
348 |
+
|
349 |
+
app = FastAPI()
|
350 |
+
setup_middleware(app)
|
351 |
+
api = create_api(app)
|
352 |
+
|
353 |
+
modules.script_callbacks.app_started_callback(None, app)
|
354 |
+
|
355 |
+
print(f"Startup time: {startup_timer.summary()}.")
|
356 |
+
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)
|
357 |
+
|
358 |
+
|
359 |
+
def stop_route(request):
|
360 |
+
shared.state.server_command = "stop"
|
361 |
+
return Response("Stopping.")
|
362 |
+
|
363 |
+
|
364 |
+
def webui():
|
365 |
+
launch_api = cmd_opts.api
|
366 |
+
initialize()
|
367 |
+
|
368 |
+
while 1:
|
369 |
+
if shared.opts.clean_temp_dir_at_start:
|
370 |
+
ui_tempdir.cleanup_tmpdr()
|
371 |
+
startup_timer.record("cleanup temp dir")
|
372 |
+
|
373 |
+
modules.script_callbacks.before_ui_callback()
|
374 |
+
startup_timer.record("scripts before_ui_callback")
|
375 |
+
|
376 |
+
shared.demo = modules.ui.create_ui()
|
377 |
+
startup_timer.record("create ui")
|
378 |
+
|
379 |
+
if not cmd_opts.no_gradio_queue:
|
380 |
+
shared.demo.queue(64)
|
381 |
+
|
382 |
+
gradio_auth_creds = list(get_gradio_auth_creds()) or None
|
383 |
+
|
384 |
+
# this restores the missing /docs endpoint
|
385 |
+
if launch_api and not hasattr(FastAPI, 'original_setup'):
|
386 |
+
# TODO: replace this with `launch(app_kwargs=...)` if https://github.com/gradio-app/gradio/pull/4282 gets merged
|
387 |
+
def fastapi_setup(self):
|
388 |
+
self.docs_url = "/docs"
|
389 |
+
self.redoc_url = "/redoc"
|
390 |
+
self.original_setup()
|
391 |
+
|
392 |
+
FastAPI.original_setup = FastAPI.setup
|
393 |
+
FastAPI.setup = fastapi_setup
|
394 |
+
|
395 |
+
app, local_url, share_url = shared.demo.launch(
|
396 |
+
share=cmd_opts.share,
|
397 |
+
server_name=server_name,
|
398 |
+
server_port=cmd_opts.port,
|
399 |
+
ssl_keyfile=cmd_opts.tls_keyfile,
|
400 |
+
ssl_certfile=cmd_opts.tls_certfile,
|
401 |
+
ssl_verify=cmd_opts.disable_tls_verify,
|
402 |
+
debug=cmd_opts.gradio_debug,
|
403 |
+
auth=gradio_auth_creds,
|
404 |
+
inbrowser=cmd_opts.autolaunch,
|
405 |
+
prevent_thread_lock=True,
|
406 |
+
allowed_paths=cmd_opts.gradio_allowed_path,
|
407 |
+
)
|
408 |
+
if cmd_opts.add_stop_route:
|
409 |
+
app.add_route("/_stop", stop_route, methods=["POST"])
|
410 |
+
|
411 |
+
# after initial launch, disable --autolaunch for subsequent restarts
|
412 |
+
cmd_opts.autolaunch = False
|
413 |
+
|
414 |
+
startup_timer.record("gradio launch")
|
415 |
+
|
416 |
+
# gradio uses a very open CORS policy via app.user_middleware, which makes it possible for
|
417 |
+
# an attacker to trick the user into opening a malicious HTML page, which makes a request to the
|
418 |
+
# running web ui and do whatever the attacker wants, including installing an extension and
|
419 |
+
# running its code. We disable this here. Suggested by RyotaK.
|
420 |
+
app.user_middleware = [x for x in app.user_middleware if x.cls.__name__ != 'CORSMiddleware']
|
421 |
+
|
422 |
+
setup_middleware(app)
|
423 |
+
|
424 |
+
modules.progress.setup_progress_api(app)
|
425 |
+
modules.ui.setup_ui_api(app)
|
426 |
+
|
427 |
+
if launch_api:
|
428 |
+
create_api(app)
|
429 |
+
|
430 |
+
ui_extra_networks.add_pages_to_demo(app)
|
431 |
+
|
432 |
+
modules.script_callbacks.app_started_callback(shared.demo, app)
|
433 |
+
startup_timer.record("scripts app_started_callback")
|
434 |
+
|
435 |
+
print(f"Startup time: {startup_timer.summary()}.")
|
436 |
+
|
437 |
+
if cmd_opts.subpath:
|
438 |
+
redirector = FastAPI()
|
439 |
+
redirector.get("/")
|
440 |
+
gradio.mount_gradio_app(redirector, shared.demo, path=f"/{cmd_opts.subpath}")
|
441 |
+
|
442 |
+
try:
|
443 |
+
while True:
|
444 |
+
server_command = shared.state.wait_for_server_command(timeout=5)
|
445 |
+
if server_command:
|
446 |
+
if server_command in ("stop", "restart"):
|
447 |
+
break
|
448 |
+
else:
|
449 |
+
print(f"Unknown server command: {server_command}")
|
450 |
+
except KeyboardInterrupt:
|
451 |
+
print('Caught KeyboardInterrupt, stopping...')
|
452 |
+
server_command = "stop"
|
453 |
+
|
454 |
+
if server_command == "stop":
|
455 |
+
print("Stopping server...")
|
456 |
+
# If we catch a keyboard interrupt, we want to stop the server and exit.
|
457 |
+
shared.demo.close()
|
458 |
+
break
|
459 |
+
print('Restarting UI...')
|
460 |
+
shared.demo.close()
|
461 |
+
time.sleep(0.5)
|
462 |
+
startup_timer.reset()
|
463 |
+
modules.script_callbacks.app_reload_callback()
|
464 |
+
startup_timer.record("app reload callback")
|
465 |
+
modules.script_callbacks.script_unloaded_callback()
|
466 |
+
startup_timer.record("scripts unloaded callback")
|
467 |
+
initialize_rest(reload_script_modules=True)
|
468 |
+
|
469 |
+
modules.script_callbacks.on_list_optimizers(modules.sd_hijack_optimizations.list_optimizers)
|
470 |
+
modules.sd_hijack.list_optimizers()
|
471 |
+
startup_timer.record("scripts list_optimizers")
|
472 |
+
|
473 |
+
|
474 |
+
if __name__ == "__main__":
|
475 |
+
if cmd_opts.nowebui:
|
476 |
+
api_only()
|
477 |
+
else:
|
478 |
+
webui()
|
webui.sh
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
#################################################
|
3 |
+
# Please do not make any changes to this file, #
|
4 |
+
# change the variables in webui-user.sh instead #
|
5 |
+
#################################################
|
6 |
+
|
7 |
+
# If run from macOS, load defaults from webui-macos-env.sh
|
8 |
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
9 |
+
if [[ -f webui-macos-env.sh ]]
|
10 |
+
then
|
11 |
+
source ./webui-macos-env.sh
|
12 |
+
fi
|
13 |
+
fi
|
14 |
+
|
15 |
+
# Read variables from webui-user.sh
|
16 |
+
# shellcheck source=/dev/null
|
17 |
+
if [[ -f webui-user.sh ]]
|
18 |
+
then
|
19 |
+
source ./webui-user.sh
|
20 |
+
fi
|
21 |
+
|
22 |
+
# Set defaults
|
23 |
+
# Install directory without trailing slash
|
24 |
+
if [[ -z "${install_dir}" ]]
|
25 |
+
then
|
26 |
+
install_dir="$(pwd)"
|
27 |
+
fi
|
28 |
+
|
29 |
+
# Name of the subdirectory (defaults to stable-diffusion-webui)
|
30 |
+
if [[ -z "${clone_dir}" ]]
|
31 |
+
then
|
32 |
+
clone_dir="stable-diffusion-webui"
|
33 |
+
fi
|
34 |
+
|
35 |
+
# python3 executable
|
36 |
+
if [[ -z "${python_cmd}" ]]
|
37 |
+
then
|
38 |
+
python_cmd="python3"
|
39 |
+
fi
|
40 |
+
|
41 |
+
# git executable
|
42 |
+
if [[ -z "${GIT}" ]]
|
43 |
+
then
|
44 |
+
export GIT="git"
|
45 |
+
fi
|
46 |
+
|
47 |
+
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
48 |
+
if [[ -z "${venv_dir}" ]]
|
49 |
+
then
|
50 |
+
venv_dir="venv"
|
51 |
+
fi
|
52 |
+
|
53 |
+
if [[ -z "${LAUNCH_SCRIPT}" ]]
|
54 |
+
then
|
55 |
+
LAUNCH_SCRIPT="launch.py"
|
56 |
+
fi
|
57 |
+
|
58 |
+
# this script cannot be run as root by default
|
59 |
+
can_run_as_root=0
|
60 |
+
|
61 |
+
# read any command line flags to the webui.sh script
|
62 |
+
while getopts "f" flag > /dev/null 2>&1
|
63 |
+
do
|
64 |
+
case ${flag} in
|
65 |
+
f) can_run_as_root=1;;
|
66 |
+
*) break;;
|
67 |
+
esac
|
68 |
+
done
|
69 |
+
|
70 |
+
# Disable sentry logging
|
71 |
+
export ERROR_REPORTING=FALSE
|
72 |
+
|
73 |
+
# Do not reinstall existing pip packages on Debian/Ubuntu
|
74 |
+
export PIP_IGNORE_INSTALLED=0
|
75 |
+
|
76 |
+
# Pretty print
|
77 |
+
delimiter="################################################################"
|
78 |
+
|
79 |
+
printf "\n%s\n" "${delimiter}"
|
80 |
+
printf "\e[1m\e[32mInstall script for stable-diffusion + Web UI\n"
|
81 |
+
printf "\e[1m\e[34mTested on Debian 11 (Bullseye)\e[0m"
|
82 |
+
printf "\n%s\n" "${delimiter}"
|
83 |
+
|
84 |
+
# Do not run as root
|
85 |
+
if [[ $(id -u) -eq 0 && can_run_as_root -eq 0 ]]
|
86 |
+
then
|
87 |
+
printf "\n%s\n" "${delimiter}"
|
88 |
+
printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"
|
89 |
+
printf "\n%s\n" "${delimiter}"
|
90 |
+
exit 1
|
91 |
+
else
|
92 |
+
printf "\n%s\n" "${delimiter}"
|
93 |
+
printf "Running on \e[1m\e[32m%s\e[0m user" "$(whoami)"
|
94 |
+
printf "\n%s\n" "${delimiter}"
|
95 |
+
fi
|
96 |
+
|
97 |
+
if [[ $(getconf LONG_BIT) = 32 ]]
|
98 |
+
then
|
99 |
+
printf "\n%s\n" "${delimiter}"
|
100 |
+
printf "\e[1m\e[31mERROR: Unsupported Running on a 32bit OS\e[0m"
|
101 |
+
printf "\n%s\n" "${delimiter}"
|
102 |
+
exit 1
|
103 |
+
fi
|
104 |
+
|
105 |
+
if [[ -d .git ]]
|
106 |
+
then
|
107 |
+
printf "\n%s\n" "${delimiter}"
|
108 |
+
printf "Repo already cloned, using it as install directory"
|
109 |
+
printf "\n%s\n" "${delimiter}"
|
110 |
+
install_dir="${PWD}/../"
|
111 |
+
clone_dir="${PWD##*/}"
|
112 |
+
fi
|
113 |
+
|
114 |
+
# Check prerequisites
|
115 |
+
gpu_info=$(lspci 2>/dev/null | grep VGA)
|
116 |
+
case "$gpu_info" in
|
117 |
+
*"Navi 1"*|*"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0
|
118 |
+
;;
|
119 |
+
*"Renoir"*) export HSA_OVERRIDE_GFX_VERSION=9.0.0
|
120 |
+
printf "\n%s\n" "${delimiter}"
|
121 |
+
printf "Experimental support for Renoir: make sure to have at least 4GB of VRAM and 10GB of RAM or enable cpu mode: --use-cpu all --no-half"
|
122 |
+
printf "\n%s\n" "${delimiter}"
|
123 |
+
;;
|
124 |
+
*)
|
125 |
+
;;
|
126 |
+
esac
|
127 |
+
if echo "$gpu_info" | grep -q "AMD" && [[ -z "${TORCH_COMMAND}" ]]
|
128 |
+
then
|
129 |
+
export TORCH_COMMAND="pip install torch==2.0.1+rocm5.4.2 torchvision==0.15.2+rocm5.4.2 --index-url https://download.pytorch.org/whl/rocm5.4.2"
|
130 |
+
fi
|
131 |
+
|
132 |
+
for preq in "${GIT}" "${python_cmd}"
|
133 |
+
do
|
134 |
+
if ! hash "${preq}" &>/dev/null
|
135 |
+
then
|
136 |
+
printf "\n%s\n" "${delimiter}"
|
137 |
+
printf "\e[1m\e[31mERROR: %s is not installed, aborting...\e[0m" "${preq}"
|
138 |
+
printf "\n%s\n" "${delimiter}"
|
139 |
+
exit 1
|
140 |
+
fi
|
141 |
+
done
|
142 |
+
|
143 |
+
if ! "${python_cmd}" -c "import venv" &>/dev/null
|
144 |
+
then
|
145 |
+
printf "\n%s\n" "${delimiter}"
|
146 |
+
printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m"
|
147 |
+
printf "\n%s\n" "${delimiter}"
|
148 |
+
exit 1
|
149 |
+
fi
|
150 |
+
|
151 |
+
cd "${install_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/, aborting...\e[0m" "${install_dir}"; exit 1; }
|
152 |
+
if [[ -d "${clone_dir}" ]]
|
153 |
+
then
|
154 |
+
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
155 |
+
else
|
156 |
+
printf "\n%s\n" "${delimiter}"
|
157 |
+
printf "Clone stable-diffusion-webui"
|
158 |
+
printf "\n%s\n" "${delimiter}"
|
159 |
+
"${GIT}" clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "${clone_dir}"
|
160 |
+
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
161 |
+
fi
|
162 |
+
|
163 |
+
if [[ -z "${VIRTUAL_ENV}" ]];
|
164 |
+
then
|
165 |
+
printf "\n%s\n" "${delimiter}"
|
166 |
+
printf "Create and activate python venv"
|
167 |
+
printf "\n%s\n" "${delimiter}"
|
168 |
+
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; }
|
169 |
+
if [[ ! -d "${venv_dir}" ]]
|
170 |
+
then
|
171 |
+
"${python_cmd}" -m venv "${venv_dir}"
|
172 |
+
first_launch=1
|
173 |
+
fi
|
174 |
+
# shellcheck source=/dev/null
|
175 |
+
if [[ -f "${venv_dir}"/bin/activate ]]
|
176 |
+
then
|
177 |
+
source "${venv_dir}"/bin/activate
|
178 |
+
else
|
179 |
+
printf "\n%s\n" "${delimiter}"
|
180 |
+
printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m"
|
181 |
+
printf "\n%s\n" "${delimiter}"
|
182 |
+
exit 1
|
183 |
+
fi
|
184 |
+
else
|
185 |
+
printf "\n%s\n" "${delimiter}"
|
186 |
+
printf "python venv already activate: ${VIRTUAL_ENV}"
|
187 |
+
printf "\n%s\n" "${delimiter}"
|
188 |
+
fi
|
189 |
+
|
190 |
+
# Try using TCMalloc on Linux
|
191 |
+
prepare_tcmalloc() {
|
192 |
+
if [[ "${OSTYPE}" == "linux"* ]] && [[ -z "${NO_TCMALLOC}" ]] && [[ -z "${LD_PRELOAD}" ]]; then
|
193 |
+
TCMALLOC="$(ldconfig -p | grep -Po "libtcmalloc.so.\d" | head -n 1)"
|
194 |
+
if [[ ! -z "${TCMALLOC}" ]]; then
|
195 |
+
echo "Using TCMalloc: ${TCMALLOC}"
|
196 |
+
export LD_PRELOAD="${TCMALLOC}"
|
197 |
+
else
|
198 |
+
printf "\e[1m\e[31mCannot locate TCMalloc (improves CPU memory usage)\e[0m\n"
|
199 |
+
fi
|
200 |
+
fi
|
201 |
+
}
|
202 |
+
|
203 |
+
if [[ ! -z "${ACCELERATE}" ]] && [ ${ACCELERATE}="True" ] && [ -x "$(command -v accelerate)" ]
|
204 |
+
then
|
205 |
+
printf "\n%s\n" "${delimiter}"
|
206 |
+
printf "Accelerating launch.py..."
|
207 |
+
printf "\n%s\n" "${delimiter}"
|
208 |
+
prepare_tcmalloc
|
209 |
+
exec accelerate launch --num_cpu_threads_per_process=6 "${LAUNCH_SCRIPT}" "$@"
|
210 |
+
else
|
211 |
+
printf "\n%s\n" "${delimiter}"
|
212 |
+
printf "Launching launch.py..."
|
213 |
+
printf "\n%s\n" "${delimiter}"
|
214 |
+
prepare_tcmalloc
|
215 |
+
exec "${python_cmd}" "${LAUNCH_SCRIPT}" "$@"
|
216 |
+
fi
|