Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
mikagekayuki
commited on
Commit
•
fb60429
1
Parent(s):
f38a9d5
001
Browse files- .gitignore +28 -0
- README.md +128 -13
- artists.csv +0 -0
- environment-wsl2.yaml +11 -0
- launch.py +164 -0
- requirements.txt +26 -2
- requirements_versions.txt +25 -0
- screenshot.png +0 -0
- script.js +62 -0
- stable-diffusion-webui-master.zip +3 -0
- style.css +455 -0
- txt2img_Screenshot.png +0 -0
- webui-user.bat +8 -0
- webui-user.sh +43 -0
- webui.bat +62 -0
- webui.py +132 -0
- webui.sh +141 -0
.gitignore
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__
|
2 |
+
*.ckpt
|
3 |
+
*.pth
|
4 |
+
/ESRGAN/*
|
5 |
+
/SwinIR/*
|
6 |
+
/repositories
|
7 |
+
/venv
|
8 |
+
/tmp
|
9 |
+
/model.ckpt
|
10 |
+
/models/**/*
|
11 |
+
/GFPGANv1.3.pth
|
12 |
+
/gfpgan/weights/*.pth
|
13 |
+
/ui-config.json
|
14 |
+
/outputs
|
15 |
+
/config.json
|
16 |
+
/log
|
17 |
+
/webui.settings.bat
|
18 |
+
/embeddings
|
19 |
+
/styles.csv
|
20 |
+
/styles.csv.bak
|
21 |
+
/webui-user.bat
|
22 |
+
/webui-user.sh
|
23 |
+
/interrogate
|
24 |
+
/user.css
|
25 |
+
/.idea
|
26 |
+
notification.mp3
|
27 |
+
/SwinIR
|
28 |
+
/textual_inversion
|
README.md
CHANGED
@@ -1,13 +1,128 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stable Diffusion web UI
|
2 |
+
A browser interface based on Gradio library for Stable Diffusion.
|
3 |
+
|
4 |
+
![](txt2img_Screenshot.png)
|
5 |
+
|
6 |
+
Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts) wiki page for extra scripts developed by users.
|
7 |
+
|
8 |
+
## Features
|
9 |
+
[Detailed feature showcase with images](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features):
|
10 |
+
- Original txt2img and img2img modes
|
11 |
+
- One click install and run script (but you still must install python and git)
|
12 |
+
- Outpainting
|
13 |
+
- Inpainting
|
14 |
+
- Prompt Matrix
|
15 |
+
- Stable Diffusion Upscale
|
16 |
+
- Attention, specify parts of text that the model should pay more attention to
|
17 |
+
- a man in a ((tuxedo)) - will pay more attention to tuxedo
|
18 |
+
- a man in a (tuxedo:1.21) - alternative syntax
|
19 |
+
- select text and press ctrl+up or ctrl+down to automatically adjust attention to selected text (code contributed by anonymous user)
|
20 |
+
- Loopback, run img2img processing multiple times
|
21 |
+
- X/Y plot, a way to draw a 2 dimensional plot of images with different parameters
|
22 |
+
- Textual Inversion
|
23 |
+
- have as many embeddings as you want and use any names you like for them
|
24 |
+
- use multiple embeddings with different numbers of vectors per token
|
25 |
+
- works with half precision floating point numbers
|
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, neural network upscaler
|
32 |
+
- LDSR, Latent diffusion super resolution upscaling
|
33 |
+
- Resizing aspect ratio options
|
34 |
+
- Sampling method selection
|
35 |
+
- Interrupt processing at any time
|
36 |
+
- 4GB video card support (also reports of 2GB working)
|
37 |
+
- Correct seeds for batches
|
38 |
+
- Prompt length validation
|
39 |
+
- get length of prompt in tokens as you type
|
40 |
+
- get a warning after generation if some text was truncated
|
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 |
+
- Settings page
|
47 |
+
- Running arbitrary python code from UI (must run with --allow-code to enable)
|
48 |
+
- Mouseover hints for most UI elements
|
49 |
+
- Possible to change defaults/mix/max/step values for UI elements via text config
|
50 |
+
- Random artist button
|
51 |
+
- Tiling support, a checkbox to create images that can be tiled like textures
|
52 |
+
- Progress bar and live image generation preview
|
53 |
+
- Negative prompt, an extra text field that allows you to list what you don't want to see in generated image
|
54 |
+
- Styles, a way to save part of prompt and easily apply them via dropdown later
|
55 |
+
- Variations, a way to generate same image but with tiny differences
|
56 |
+
- Seed resizing, a way to generate same image but at slightly different resolution
|
57 |
+
- CLIP interrogator, a button that tries to guess prompt from an image
|
58 |
+
- Prompt Editing, a way to change prompt mid-generation, say to start making a watermelon and switch to anime girl midway
|
59 |
+
- Batch Processing, process a group of files using img2img
|
60 |
+
- Img2img Alternative
|
61 |
+
- Highres Fix, a convenience option to produce high resolution pictures in one click without usual distortions
|
62 |
+
- Reloading checkpoints on the fly
|
63 |
+
- Checkpoint Merger, a tab that allows you to merge two checkpoints into one
|
64 |
+
- [Custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts) with many extensions from community
|
65 |
+
- [Composable-Diffusion](https://energy-based-model.github.io/Compositional-Visual-Generation-with-Composable-Diffusion-Models/), a way to use multiple prompts at once
|
66 |
+
- separate prompts using uppercase `AND`
|
67 |
+
- also supports weights for prompts: `a cat :1.2 AND a dog AND a penguin :2.2`
|
68 |
+
- No token limit for prompts (original stable diffusion lets you use up to 75 tokens)
|
69 |
+
- DeepDanbooru integration, creates danbooru style tags for anime prompts (add --deepdanbooru to commandline args)
|
70 |
+
|
71 |
+
## Installation and Running
|
72 |
+
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.
|
73 |
+
|
74 |
+
Alternatively, use Google Colab:
|
75 |
+
|
76 |
+
- [Colab, maintained by Akaibu](https://colab.research.google.com/drive/1kw3egmSn-KgWsikYvOMjJkVDsPLjEMzl)
|
77 |
+
- [Colab, original by me, outdated](https://colab.research.google.com/drive/1Iy-xW9t1-OQWhb0hNxueGij8phCyluOh).
|
78 |
+
|
79 |
+
### Automatic Installation on Windows
|
80 |
+
1. Install [Python 3.10.6](https://www.python.org/downloads/windows/), checking "Add Python to PATH"
|
81 |
+
2. Install [git](https://git-scm.com/download/win).
|
82 |
+
3. Download the stable-diffusion-webui repository, for example by running `git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git`.
|
83 |
+
4. Place `model.ckpt` in the `models` directory (see [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) for where to get it).
|
84 |
+
5. _*(Optional)*_ Place `GFPGANv1.4.pth` in the base directory, alongside `webui.py` (see [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) for where to get it).
|
85 |
+
6. Run `webui-user.bat` from Windows Explorer as normal, non-administrator, user.
|
86 |
+
|
87 |
+
### Automatic Installation on Linux
|
88 |
+
1. Install the dependencies:
|
89 |
+
```bash
|
90 |
+
# Debian-based:
|
91 |
+
sudo apt install wget git python3 python3-venv
|
92 |
+
# Red Hat-based:
|
93 |
+
sudo dnf install wget git python3
|
94 |
+
# Arch-based:
|
95 |
+
sudo pacman -S wget git python3
|
96 |
+
```
|
97 |
+
2. To install in `/home/$(whoami)/stable-diffusion-webui/`, run:
|
98 |
+
```bash
|
99 |
+
bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
|
100 |
+
```
|
101 |
+
|
102 |
+
### Installation on Apple Silicon
|
103 |
+
|
104 |
+
Find the instructions [here](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Installation-on-Apple-Silicon).
|
105 |
+
|
106 |
+
## Contributing
|
107 |
+
Here's how to add code to this repo: [Contributing](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Contributing)
|
108 |
+
|
109 |
+
## Documentation
|
110 |
+
The documentation was moved from this README over to the project's [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki).
|
111 |
+
|
112 |
+
## Credits
|
113 |
+
- Stable Diffusion - https://github.com/CompVis/stable-diffusion, https://github.com/CompVis/taming-transformers
|
114 |
+
- k-diffusion - https://github.com/crowsonkb/k-diffusion.git
|
115 |
+
- GFPGAN - https://github.com/TencentARC/GFPGAN.git
|
116 |
+
- CodeFormer - https://github.com/sczhou/CodeFormer
|
117 |
+
- ESRGAN - https://github.com/xinntao/ESRGAN
|
118 |
+
- SwinIR - https://github.com/JingyunLiang/SwinIR
|
119 |
+
- LDSR - https://github.com/Hafiidz/latent-diffusion
|
120 |
+
- Ideas for optimizations - https://github.com/basujindal/stable-diffusion
|
121 |
+
- Doggettx - Cross Attention layer optimization - https://github.com/Doggettx/stable-diffusion, original idea for prompt editing.
|
122 |
+
- Rinon Gal - Textual Inversion - https://github.com/rinongal/textual_inversion (we're not using his code, but we are using his ideas).
|
123 |
+
- Idea for SD upscale - https://github.com/jquesnelle/txt2imghd
|
124 |
+
- Noise generation for outpainting mk2 - https://github.com/parlance-zz/g-diffuser-bot
|
125 |
+
- CLIP interrogator idea and borrowing some code - https://github.com/pharmapsychotic/clip-interrogator
|
126 |
+
- Initial Gradio script - posted on 4chan by an Anonymous user. Thank you Anonymous user.
|
127 |
+
- DeepDanbooru - interrogator for anime diffusors https://github.com/KichangKim/DeepDanbooru
|
128 |
+
- (You)
|
artists.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
environment-wsl2.yaml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: automatic
|
2 |
+
channels:
|
3 |
+
- pytorch
|
4 |
+
- defaults
|
5 |
+
dependencies:
|
6 |
+
- python=3.8.5
|
7 |
+
- pip=20.3
|
8 |
+
- cudatoolkit=11.3
|
9 |
+
- pytorch=1.11.0
|
10 |
+
- torchvision=0.12.0
|
11 |
+
- numpy=1.19.2
|
launch.py
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# this scripts installs necessary requirements and launches main program in webui.py
|
2 |
+
import subprocess
|
3 |
+
import os
|
4 |
+
import sys
|
5 |
+
import importlib.util
|
6 |
+
import shlex
|
7 |
+
import platform
|
8 |
+
|
9 |
+
dir_repos = "repositories"
|
10 |
+
dir_tmp = "tmp"
|
11 |
+
|
12 |
+
python = sys.executable
|
13 |
+
git = os.environ.get('GIT', "git")
|
14 |
+
torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113")
|
15 |
+
requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt")
|
16 |
+
commandline_args = os.environ.get('COMMANDLINE_ARGS', "")
|
17 |
+
|
18 |
+
gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379")
|
19 |
+
clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1")
|
20 |
+
|
21 |
+
stable_diffusion_commit_hash = os.environ.get('STABLE_DIFFUSION_COMMIT_HASH', "69ae4b35e0a0f6ee1af8bb9a5d0016ccb27e36dc")
|
22 |
+
taming_transformers_commit_hash = os.environ.get('TAMING_TRANSFORMERS_COMMIT_HASH', "24268930bf1dce879235a7fddd0b2355b84d7ea6")
|
23 |
+
k_diffusion_commit_hash = os.environ.get('K_DIFFUSION_COMMIT_HASH', "f4e99857772fc3a126ba886aadf795a332774878")
|
24 |
+
codeformer_commit_hash = os.environ.get('CODEFORMER_COMMIT_HASH', "c5b4593074ba6214284d6acd5f1719b6c5d739af")
|
25 |
+
blip_commit_hash = os.environ.get('BLIP_COMMIT_HASH', "48211a1594f1321b00f14c9f7a5b4813144b2fb9")
|
26 |
+
|
27 |
+
args = shlex.split(commandline_args)
|
28 |
+
|
29 |
+
|
30 |
+
def extract_arg(args, name):
|
31 |
+
return [x for x in args if x != name], name in args
|
32 |
+
|
33 |
+
|
34 |
+
args, skip_torch_cuda_test = extract_arg(args, '--skip-torch-cuda-test')
|
35 |
+
xformers = '--xformers' in args
|
36 |
+
deepdanbooru = '--deepdanbooru' in args
|
37 |
+
|
38 |
+
|
39 |
+
def repo_dir(name):
|
40 |
+
return os.path.join(dir_repos, name)
|
41 |
+
|
42 |
+
|
43 |
+
def run(command, desc=None, errdesc=None):
|
44 |
+
if desc is not None:
|
45 |
+
print(desc)
|
46 |
+
|
47 |
+
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
48 |
+
|
49 |
+
if result.returncode != 0:
|
50 |
+
|
51 |
+
message = f"""{errdesc or 'Error running command'}.
|
52 |
+
Command: {command}
|
53 |
+
Error code: {result.returncode}
|
54 |
+
stdout: {result.stdout.decode(encoding="utf8", errors="ignore") if len(result.stdout)>0 else '<empty>'}
|
55 |
+
stderr: {result.stderr.decode(encoding="utf8", errors="ignore") if len(result.stderr)>0 else '<empty>'}
|
56 |
+
"""
|
57 |
+
raise RuntimeError(message)
|
58 |
+
|
59 |
+
return result.stdout.decode(encoding="utf8", errors="ignore")
|
60 |
+
|
61 |
+
|
62 |
+
def run_python(code, desc=None, errdesc=None):
|
63 |
+
return run(f'"{python}" -c "{code}"', desc, errdesc)
|
64 |
+
|
65 |
+
|
66 |
+
def run_pip(args, desc=None):
|
67 |
+
return run(f'"{python}" -m pip {args} --prefer-binary', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
|
68 |
+
|
69 |
+
|
70 |
+
def check_run(command):
|
71 |
+
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
72 |
+
return result.returncode == 0
|
73 |
+
|
74 |
+
|
75 |
+
def check_run_python(code):
|
76 |
+
return check_run(f'"{python}" -c "{code}"')
|
77 |
+
|
78 |
+
|
79 |
+
def is_installed(package):
|
80 |
+
try:
|
81 |
+
spec = importlib.util.find_spec(package)
|
82 |
+
except ModuleNotFoundError:
|
83 |
+
return False
|
84 |
+
|
85 |
+
return spec is not None
|
86 |
+
|
87 |
+
|
88 |
+
def git_clone(url, dir, name, commithash=None):
|
89 |
+
# TODO clone into temporary dir and move if successful
|
90 |
+
|
91 |
+
if os.path.exists(dir):
|
92 |
+
if commithash is None:
|
93 |
+
return
|
94 |
+
|
95 |
+
current_hash = run(f'"{git}" -C {dir} rev-parse HEAD', None, f"Couldn't determine {name}'s hash: {commithash}").strip()
|
96 |
+
if current_hash == commithash:
|
97 |
+
return
|
98 |
+
|
99 |
+
run(f'"{git}" -C {dir} fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")
|
100 |
+
run(f'"{git}" -C {dir} checkout {commithash}', f"Checking out commint for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}")
|
101 |
+
return
|
102 |
+
|
103 |
+
run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}")
|
104 |
+
|
105 |
+
if commithash is not None:
|
106 |
+
run(f'"{git}" -C {dir} checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")
|
107 |
+
|
108 |
+
|
109 |
+
try:
|
110 |
+
commit = run(f"{git} rev-parse HEAD").strip()
|
111 |
+
except Exception:
|
112 |
+
commit = "<none>"
|
113 |
+
|
114 |
+
print(f"Python {sys.version}")
|
115 |
+
print(f"Commit hash: {commit}")
|
116 |
+
|
117 |
+
|
118 |
+
if not is_installed("torch") or not is_installed("torchvision"):
|
119 |
+
run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch")
|
120 |
+
|
121 |
+
if not skip_torch_cuda_test:
|
122 |
+
run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")
|
123 |
+
|
124 |
+
if not is_installed("gfpgan"):
|
125 |
+
run_pip(f"install {gfpgan_package}", "gfpgan")
|
126 |
+
|
127 |
+
if not is_installed("clip"):
|
128 |
+
run_pip(f"install {clip_package}", "clip")
|
129 |
+
|
130 |
+
if not is_installed("xformers") and xformers and platform.python_version().startswith("3.10"):
|
131 |
+
if platform.system() == "Windows":
|
132 |
+
run_pip("install https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/a/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl", "xformers")
|
133 |
+
elif platform.system() == "Linux":
|
134 |
+
run_pip("install xformers", "xformers")
|
135 |
+
|
136 |
+
if not is_installed("deepdanbooru") and deepdanbooru:
|
137 |
+
run_pip("install git+https://github.com/KichangKim/DeepDanbooru.git@edf73df4cdaeea2cf00e9ac08bd8a9026b7a7b26#egg=deepdanbooru[tensorflow] tensorflow==2.10.0 tensorflow-io==0.27.0", "deepdanbooru")
|
138 |
+
|
139 |
+
os.makedirs(dir_repos, exist_ok=True)
|
140 |
+
|
141 |
+
git_clone("https://github.com/CompVis/stable-diffusion.git", repo_dir('stable-diffusion'), "Stable Diffusion", stable_diffusion_commit_hash)
|
142 |
+
git_clone("https://github.com/CompVis/taming-transformers.git", repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
|
143 |
+
git_clone("https://github.com/crowsonkb/k-diffusion.git", repo_dir('k-diffusion'), "K-diffusion", k_diffusion_commit_hash)
|
144 |
+
git_clone("https://github.com/sczhou/CodeFormer.git", repo_dir('CodeFormer'), "CodeFormer", codeformer_commit_hash)
|
145 |
+
git_clone("https://github.com/salesforce/BLIP.git", repo_dir('BLIP'), "BLIP", blip_commit_hash)
|
146 |
+
|
147 |
+
if not is_installed("lpips"):
|
148 |
+
run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}", "requirements for CodeFormer")
|
149 |
+
|
150 |
+
run_pip(f"install -r {requirements_file}", "requirements for Web UI")
|
151 |
+
|
152 |
+
sys.argv += args
|
153 |
+
|
154 |
+
if "--exit" in args:
|
155 |
+
print("Exiting because of --exit argument")
|
156 |
+
exit(0)
|
157 |
+
|
158 |
+
def start_webui():
|
159 |
+
print(f"Launching Web UI with arguments: {' '.join(sys.argv[1:])}")
|
160 |
+
import webui
|
161 |
+
webui.webui()
|
162 |
+
|
163 |
+
if __name__ == "__main__":
|
164 |
+
start_webui()
|
requirements.txt
CHANGED
@@ -1,2 +1,26 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
basicsr
|
2 |
+
diffusers
|
3 |
+
fairscale==0.4.4
|
4 |
+
fonts
|
5 |
+
font-roboto
|
6 |
+
gfpgan
|
7 |
+
gradio==3.4b3
|
8 |
+
invisible-watermark
|
9 |
+
numpy
|
10 |
+
omegaconf
|
11 |
+
piexif
|
12 |
+
Pillow
|
13 |
+
pytorch_lightning
|
14 |
+
realesrgan
|
15 |
+
scikit-image>=0.19
|
16 |
+
timm==0.4.12
|
17 |
+
transformers==4.19.2
|
18 |
+
torch
|
19 |
+
einops
|
20 |
+
jsonmerge
|
21 |
+
clean-fid
|
22 |
+
resize-right
|
23 |
+
torchdiffeq
|
24 |
+
kornia
|
25 |
+
lark
|
26 |
+
functorch
|
requirements_versions.txt
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers==4.19.2
|
2 |
+
diffusers==0.3.0
|
3 |
+
basicsr==1.4.2
|
4 |
+
gfpgan==1.3.8
|
5 |
+
gradio==3.4b3
|
6 |
+
numpy==1.23.3
|
7 |
+
Pillow==9.2.0
|
8 |
+
realesrgan==0.3.0
|
9 |
+
torch
|
10 |
+
omegaconf==2.2.3
|
11 |
+
pytorch_lightning==1.7.6
|
12 |
+
scikit-image==0.19.2
|
13 |
+
fonts
|
14 |
+
font-roboto
|
15 |
+
timm==0.6.7
|
16 |
+
fairscale==0.4.9
|
17 |
+
piexif==1.1.3
|
18 |
+
einops==0.4.1
|
19 |
+
jsonmerge==1.8.0
|
20 |
+
clean-fid==0.1.29
|
21 |
+
resize-right==0.0.2
|
22 |
+
torchdiffeq==0.2.3
|
23 |
+
kornia==0.6.7
|
24 |
+
lark==1.1.2
|
25 |
+
functorch==0.2.1
|
screenshot.png
ADDED
script.js
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function gradioApp(){
|
2 |
+
return document.getElementsByTagName('gradio-app')[0].shadowRoot;
|
3 |
+
}
|
4 |
+
|
5 |
+
function get_uiCurrentTab() {
|
6 |
+
return gradioApp().querySelector('.tabs button:not(.border-transparent)')
|
7 |
+
}
|
8 |
+
|
9 |
+
uiUpdateCallbacks = []
|
10 |
+
uiTabChangeCallbacks = []
|
11 |
+
let uiCurrentTab = null
|
12 |
+
|
13 |
+
function onUiUpdate(callback){
|
14 |
+
uiUpdateCallbacks.push(callback)
|
15 |
+
}
|
16 |
+
function onUiTabChange(callback){
|
17 |
+
uiTabChangeCallbacks.push(callback)
|
18 |
+
}
|
19 |
+
|
20 |
+
function runCallback(x){
|
21 |
+
try {
|
22 |
+
x()
|
23 |
+
} catch (e) {
|
24 |
+
(console.error || console.log).call(console, e.message, e);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
function executeCallbacks(queue) {
|
28 |
+
queue.forEach(runCallback)
|
29 |
+
}
|
30 |
+
|
31 |
+
document.addEventListener("DOMContentLoaded", function() {
|
32 |
+
var mutationObserver = new MutationObserver(function(m){
|
33 |
+
executeCallbacks(uiUpdateCallbacks);
|
34 |
+
const newTab = get_uiCurrentTab();
|
35 |
+
if ( newTab && ( newTab !== uiCurrentTab ) ) {
|
36 |
+
uiCurrentTab = newTab;
|
37 |
+
executeCallbacks(uiTabChangeCallbacks);
|
38 |
+
}
|
39 |
+
});
|
40 |
+
mutationObserver.observe( gradioApp(), { childList:true, subtree:true })
|
41 |
+
});
|
42 |
+
|
43 |
+
/**
|
44 |
+
* checks that a UI element is not in another hidden element or tab content
|
45 |
+
*/
|
46 |
+
function uiElementIsVisible(el) {
|
47 |
+
let isVisible = !el.closest('.\\!hidden');
|
48 |
+
if ( ! isVisible ) {
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
while( isVisible = el.closest('.tabitem')?.style.display !== 'none' ) {
|
53 |
+
if ( ! isVisible ) {
|
54 |
+
return false;
|
55 |
+
} else if ( el.parentElement ) {
|
56 |
+
el = el.parentElement
|
57 |
+
} else {
|
58 |
+
break;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
return isVisible;
|
62 |
+
}
|
stable-diffusion-webui-master.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ec3f1e75b72aeee4a2a4dd9a663079677fc333d881f1d4e36b9e810575879cb
|
3 |
+
size 1249918
|
style.css
ADDED
@@ -0,0 +1,455 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.output-html p {margin: 0 0.5em;}
|
2 |
+
|
3 |
+
.row > *,
|
4 |
+
.row > .gr-form > * {
|
5 |
+
min-width: min(120px, 100%);
|
6 |
+
flex: 1 1 0%;
|
7 |
+
}
|
8 |
+
|
9 |
+
.performance {
|
10 |
+
font-size: 0.85em;
|
11 |
+
color: #444;
|
12 |
+
display: flex;
|
13 |
+
justify-content: space-between;
|
14 |
+
white-space: nowrap;
|
15 |
+
}
|
16 |
+
|
17 |
+
.performance .time {
|
18 |
+
margin-right: 0;
|
19 |
+
}
|
20 |
+
|
21 |
+
.performance .vram {
|
22 |
+
margin-left: 0;
|
23 |
+
text-align: right;
|
24 |
+
}
|
25 |
+
|
26 |
+
#txt2img_generate, #img2img_generate {
|
27 |
+
min-height: 4.5em;
|
28 |
+
}
|
29 |
+
|
30 |
+
@media screen and (min-width: 2500px) {
|
31 |
+
#txt2img_gallery, #img2img_gallery {
|
32 |
+
min-height: 768px;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
#txt2img_gallery img, #img2img_gallery img{
|
37 |
+
object-fit: scale-down;
|
38 |
+
}
|
39 |
+
|
40 |
+
.justify-center.overflow-x-scroll {
|
41 |
+
justify-content: left;
|
42 |
+
}
|
43 |
+
|
44 |
+
.justify-center.overflow-x-scroll button:first-of-type {
|
45 |
+
margin-left: auto;
|
46 |
+
}
|
47 |
+
|
48 |
+
.justify-center.overflow-x-scroll button:last-of-type {
|
49 |
+
margin-right: auto;
|
50 |
+
}
|
51 |
+
|
52 |
+
#random_seed, #random_subseed, #reuse_seed, #reuse_subseed, #open_folder{
|
53 |
+
min-width: auto;
|
54 |
+
flex-grow: 0;
|
55 |
+
padding-left: 0.25em;
|
56 |
+
padding-right: 0.25em;
|
57 |
+
}
|
58 |
+
|
59 |
+
#hidden_element{
|
60 |
+
display: none;
|
61 |
+
}
|
62 |
+
|
63 |
+
#seed_row, #subseed_row{
|
64 |
+
gap: 0.5rem;
|
65 |
+
}
|
66 |
+
|
67 |
+
#subseed_show_box{
|
68 |
+
min-width: auto;
|
69 |
+
flex-grow: 0;
|
70 |
+
}
|
71 |
+
|
72 |
+
#subseed_show_box > div{
|
73 |
+
border: 0;
|
74 |
+
height: 100%;
|
75 |
+
}
|
76 |
+
|
77 |
+
#subseed_show{
|
78 |
+
min-width: auto;
|
79 |
+
flex-grow: 0;
|
80 |
+
padding: 0;
|
81 |
+
}
|
82 |
+
|
83 |
+
#subseed_show label{
|
84 |
+
height: 100%;
|
85 |
+
}
|
86 |
+
|
87 |
+
#roll_col{
|
88 |
+
min-width: unset !important;
|
89 |
+
flex-grow: 0 !important;
|
90 |
+
padding: 0.4em 0;
|
91 |
+
}
|
92 |
+
|
93 |
+
#roll, #paste{
|
94 |
+
min-width: 2em;
|
95 |
+
min-height: 2em;
|
96 |
+
max-width: 2em;
|
97 |
+
max-height: 2em;
|
98 |
+
flex-grow: 0;
|
99 |
+
padding-left: 0.25em;
|
100 |
+
padding-right: 0.25em;
|
101 |
+
margin: 0.1em 0;
|
102 |
+
}
|
103 |
+
|
104 |
+
#style_apply, #style_create, #interrogate{
|
105 |
+
margin: 0.75em 0.25em 0.25em 0.25em;
|
106 |
+
min-width: 5em;
|
107 |
+
}
|
108 |
+
|
109 |
+
#style_apply, #style_create, #deepbooru{
|
110 |
+
margin: 0.75em 0.25em 0.25em 0.25em;
|
111 |
+
min-width: 5em;
|
112 |
+
}
|
113 |
+
|
114 |
+
#style_pos_col, #style_neg_col{
|
115 |
+
min-width: 8em !important;
|
116 |
+
}
|
117 |
+
|
118 |
+
#txt2img_style_index, #txt2img_style2_index, #img2img_style_index, #img2img_style2_index{
|
119 |
+
margin-top: 1em;
|
120 |
+
}
|
121 |
+
|
122 |
+
.gr-form{
|
123 |
+
background: transparent;
|
124 |
+
}
|
125 |
+
|
126 |
+
.my-4{
|
127 |
+
margin-top: 0;
|
128 |
+
margin-bottom: 0;
|
129 |
+
}
|
130 |
+
|
131 |
+
#toprow div{
|
132 |
+
border: none;
|
133 |
+
gap: 0;
|
134 |
+
background: transparent;
|
135 |
+
}
|
136 |
+
|
137 |
+
#resize_mode{
|
138 |
+
flex: 1.5;
|
139 |
+
}
|
140 |
+
|
141 |
+
button{
|
142 |
+
align-self: stretch !important;
|
143 |
+
}
|
144 |
+
|
145 |
+
#prompt, #negative_prompt{
|
146 |
+
border: none !important;
|
147 |
+
}
|
148 |
+
#prompt textarea, #negative_prompt textarea{
|
149 |
+
border: none !important;
|
150 |
+
}
|
151 |
+
|
152 |
+
|
153 |
+
#img2maskimg .h-60{
|
154 |
+
height: 30rem;
|
155 |
+
}
|
156 |
+
|
157 |
+
.overflow-hidden, .gr-panel{
|
158 |
+
overflow: visible !important;
|
159 |
+
}
|
160 |
+
|
161 |
+
#x_type, #y_type{
|
162 |
+
max-width: 10em;
|
163 |
+
}
|
164 |
+
|
165 |
+
#txt2img_preview, #img2img_preview, #ti_preview{
|
166 |
+
position: absolute;
|
167 |
+
width: 320px;
|
168 |
+
left: 0;
|
169 |
+
right: 0;
|
170 |
+
margin-left: auto;
|
171 |
+
margin-right: auto;
|
172 |
+
margin-top: 34px;
|
173 |
+
z-index: 100;
|
174 |
+
border: none;
|
175 |
+
border-top-left-radius: 0;
|
176 |
+
border-top-right-radius: 0;
|
177 |
+
}
|
178 |
+
|
179 |
+
@media screen and (min-width: 768px) {
|
180 |
+
#txt2img_preview, #img2img_preview, #ti_preview {
|
181 |
+
position: absolute;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
@media screen and (max-width: 767px) {
|
186 |
+
#txt2img_preview, #img2img_preview, #ti_preview {
|
187 |
+
position: relative;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
#txt2img_preview div.left-0.top-0, #img2img_preview div.left-0.top-0, #ti_preview div.left-0.top-0{
|
192 |
+
display: none;
|
193 |
+
}
|
194 |
+
|
195 |
+
fieldset span.text-gray-500, .gr-block.gr-box span.text-gray-500, label.block span{
|
196 |
+
position: absolute;
|
197 |
+
top: -0.6em;
|
198 |
+
line-height: 1.2em;
|
199 |
+
padding: 0 0.5em;
|
200 |
+
margin: 0;
|
201 |
+
|
202 |
+
background-color: white;
|
203 |
+
border-top: 1px solid #eee;
|
204 |
+
border-left: 1px solid #eee;
|
205 |
+
border-right: 1px solid #eee;
|
206 |
+
}
|
207 |
+
|
208 |
+
.dark fieldset span.text-gray-500, .dark .gr-block.gr-box span.text-gray-500, .dark label.block span{
|
209 |
+
background-color: rgb(31, 41, 55);
|
210 |
+
border-top: 1px solid rgb(55 65 81);
|
211 |
+
border-left: 1px solid rgb(55 65 81);
|
212 |
+
border-right: 1px solid rgb(55 65 81);
|
213 |
+
}
|
214 |
+
|
215 |
+
#settings fieldset span.text-gray-500, #settings .gr-block.gr-box span.text-gray-500, #settings label.block span{
|
216 |
+
position: relative;
|
217 |
+
border: none;
|
218 |
+
}
|
219 |
+
|
220 |
+
.gr-panel div.flex-col div.justify-between label span{
|
221 |
+
margin: 0;
|
222 |
+
}
|
223 |
+
|
224 |
+
.gr-panel div.flex-col div.justify-between div{
|
225 |
+
position: absolute;
|
226 |
+
top: -0.1em;
|
227 |
+
right: 1em;
|
228 |
+
padding: 0 0.5em;
|
229 |
+
}
|
230 |
+
|
231 |
+
#settings .gr-panel div.flex-col div.justify-between div{
|
232 |
+
position: relative;
|
233 |
+
z-index: 200;
|
234 |
+
}
|
235 |
+
|
236 |
+
input[type="range"]{
|
237 |
+
margin: 0.5em 0 -0.3em 0;
|
238 |
+
}
|
239 |
+
|
240 |
+
#txt2img_sampling label{
|
241 |
+
padding-left: 0.6em;
|
242 |
+
padding-right: 0.6em;
|
243 |
+
}
|
244 |
+
|
245 |
+
#mask_bug_info {
|
246 |
+
text-align: center;
|
247 |
+
display: block;
|
248 |
+
margin-top: -0.75em;
|
249 |
+
margin-bottom: -0.75em;
|
250 |
+
}
|
251 |
+
|
252 |
+
#txt2img_negative_prompt, #img2img_negative_prompt{
|
253 |
+
}
|
254 |
+
|
255 |
+
#txt2img_progressbar, #img2img_progressbar, #ti_progressbar{
|
256 |
+
position: absolute;
|
257 |
+
z-index: 1000;
|
258 |
+
right: 0;
|
259 |
+
padding-left: 5px;
|
260 |
+
padding-right: 5px;
|
261 |
+
display: block;
|
262 |
+
}
|
263 |
+
|
264 |
+
#txt2img_progress_row, #img2img_progress_row{
|
265 |
+
margin-bottom: 10px;
|
266 |
+
margin-top: -18px;
|
267 |
+
}
|
268 |
+
|
269 |
+
.progressDiv{
|
270 |
+
width: 100%;
|
271 |
+
height: 20px;
|
272 |
+
background: #b4c0cc;
|
273 |
+
border-radius: 8px;
|
274 |
+
}
|
275 |
+
|
276 |
+
.dark .progressDiv{
|
277 |
+
background: #424c5b;
|
278 |
+
}
|
279 |
+
|
280 |
+
.progressDiv .progress{
|
281 |
+
width: 0%;
|
282 |
+
height: 20px;
|
283 |
+
background: #0060df;
|
284 |
+
color: white;
|
285 |
+
font-weight: bold;
|
286 |
+
line-height: 20px;
|
287 |
+
padding: 0 8px 0 0;
|
288 |
+
text-align: right;
|
289 |
+
border-radius: 8px;
|
290 |
+
}
|
291 |
+
|
292 |
+
#lightboxModal{
|
293 |
+
display: none;
|
294 |
+
position: fixed;
|
295 |
+
z-index: 1001;
|
296 |
+
padding-top: 100px;
|
297 |
+
left: 0;
|
298 |
+
top: 0;
|
299 |
+
width: 100%;
|
300 |
+
height: 100%;
|
301 |
+
overflow: auto;
|
302 |
+
background-color: rgba(20, 20, 20, 0.95);
|
303 |
+
}
|
304 |
+
|
305 |
+
.modalControls {
|
306 |
+
display: grid;
|
307 |
+
grid-template-columns: 32px auto 1fr 32px;
|
308 |
+
grid-template-areas: "zoom tile space close";
|
309 |
+
position: absolute;
|
310 |
+
top: 0;
|
311 |
+
left: 0;
|
312 |
+
right: 0;
|
313 |
+
padding: 16px;
|
314 |
+
gap: 16px;
|
315 |
+
background-color: rgba(0,0,0,0.2);
|
316 |
+
}
|
317 |
+
|
318 |
+
.modalClose {
|
319 |
+
grid-area: close;
|
320 |
+
}
|
321 |
+
|
322 |
+
.modalZoom {
|
323 |
+
grid-area: zoom;
|
324 |
+
}
|
325 |
+
|
326 |
+
.modalTileImage {
|
327 |
+
grid-area: tile;
|
328 |
+
}
|
329 |
+
|
330 |
+
.modalClose,
|
331 |
+
.modalZoom,
|
332 |
+
.modalTileImage {
|
333 |
+
color: white;
|
334 |
+
font-size: 35px;
|
335 |
+
font-weight: bold;
|
336 |
+
cursor: pointer;
|
337 |
+
}
|
338 |
+
|
339 |
+
.modalClose:hover,
|
340 |
+
.modalClose:focus,
|
341 |
+
.modalZoom:hover,
|
342 |
+
.modalZoom:focus {
|
343 |
+
color: #999;
|
344 |
+
text-decoration: none;
|
345 |
+
cursor: pointer;
|
346 |
+
}
|
347 |
+
|
348 |
+
#modalImage {
|
349 |
+
display: block;
|
350 |
+
margin-left: auto;
|
351 |
+
margin-right: auto;
|
352 |
+
margin-top: auto;
|
353 |
+
width: auto;
|
354 |
+
}
|
355 |
+
|
356 |
+
.modalImageFullscreen {
|
357 |
+
object-fit: contain;
|
358 |
+
height: 90%;
|
359 |
+
}
|
360 |
+
|
361 |
+
.modalPrev,
|
362 |
+
.modalNext {
|
363 |
+
cursor: pointer;
|
364 |
+
position: absolute;
|
365 |
+
top: 50%;
|
366 |
+
width: auto;
|
367 |
+
padding: 16px;
|
368 |
+
margin-top: -50px;
|
369 |
+
color: white;
|
370 |
+
font-weight: bold;
|
371 |
+
font-size: 20px;
|
372 |
+
transition: 0.6s ease;
|
373 |
+
border-radius: 0 3px 3px 0;
|
374 |
+
user-select: none;
|
375 |
+
-webkit-user-select: none;
|
376 |
+
}
|
377 |
+
|
378 |
+
.modalNext {
|
379 |
+
right: 0;
|
380 |
+
border-radius: 3px 0 0 3px;
|
381 |
+
}
|
382 |
+
|
383 |
+
.modalPrev:hover,
|
384 |
+
.modalNext:hover {
|
385 |
+
background-color: rgba(0, 0, 0, 0.8);
|
386 |
+
}
|
387 |
+
|
388 |
+
#imageARPreview{
|
389 |
+
position:absolute;
|
390 |
+
top:0px;
|
391 |
+
left:0px;
|
392 |
+
border:2px solid red;
|
393 |
+
background:rgba(255, 0, 0, 0.3);
|
394 |
+
z-index: 900;
|
395 |
+
pointer-events:none;
|
396 |
+
display:none
|
397 |
+
}
|
398 |
+
|
399 |
+
#txt2img_interrupt, #img2img_interrupt{
|
400 |
+
position: absolute;
|
401 |
+
width: 50%;
|
402 |
+
height: 72px;
|
403 |
+
background: #b4c0cc;
|
404 |
+
border-radius: 0px;
|
405 |
+
display: none;
|
406 |
+
}
|
407 |
+
|
408 |
+
#txt2img_skip, #img2img_skip{
|
409 |
+
position: absolute;
|
410 |
+
width: 50%;
|
411 |
+
right: 0px;
|
412 |
+
height: 72px;
|
413 |
+
background: #b4c0cc;
|
414 |
+
border-radius: 0px;
|
415 |
+
display: none;
|
416 |
+
}
|
417 |
+
|
418 |
+
.red {
|
419 |
+
color: red;
|
420 |
+
}
|
421 |
+
|
422 |
+
.gallery-item {
|
423 |
+
--tw-bg-opacity: 0 !important;
|
424 |
+
}
|
425 |
+
|
426 |
+
#img2img_image div.h-60{
|
427 |
+
height: 480px;
|
428 |
+
}
|
429 |
+
|
430 |
+
#context-menu{
|
431 |
+
z-index:9999;
|
432 |
+
position:absolute;
|
433 |
+
display:block;
|
434 |
+
padding:0px 0;
|
435 |
+
border:2px solid #a55000;
|
436 |
+
border-radius:8px;
|
437 |
+
box-shadow:1px 1px 2px #CE6400;
|
438 |
+
width: 200px;
|
439 |
+
}
|
440 |
+
|
441 |
+
.context-menu-items{
|
442 |
+
list-style: none;
|
443 |
+
margin: 0;
|
444 |
+
padding: 0;
|
445 |
+
}
|
446 |
+
|
447 |
+
.context-menu-items a{
|
448 |
+
display:block;
|
449 |
+
padding:5px;
|
450 |
+
cursor:pointer;
|
451 |
+
}
|
452 |
+
|
453 |
+
.context-menu-items a:hover{
|
454 |
+
background: #a55000;
|
455 |
+
}
|
txt2img_Screenshot.png
ADDED
webui-user.bat
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
|
3 |
+
set PYTHON=
|
4 |
+
set GIT=
|
5 |
+
set VENV_DIR=
|
6 |
+
set COMMANDLINE_ARGS=
|
7 |
+
|
8 |
+
call webui.bat
|
webui-user.sh
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
#########################################################
|
3 |
+
# Uncomment and change the variables below to your need:#
|
4 |
+
#########################################################
|
5 |
+
|
6 |
+
# Install directory without trailing slash
|
7 |
+
#install_dir="/home/$(whoami)"
|
8 |
+
|
9 |
+
# Name of the subdirectory
|
10 |
+
#clone_dir="stable-diffusion-webui"
|
11 |
+
|
12 |
+
# Commandline arguments for webui.py, for example: export COMMANDLINE_ARGS="--medvram --opt-split-attention"
|
13 |
+
export COMMANDLINE_ARGS=""
|
14 |
+
|
15 |
+
# python3 executable
|
16 |
+
#python_cmd="python3"
|
17 |
+
|
18 |
+
# git executable
|
19 |
+
#export GIT="git"
|
20 |
+
|
21 |
+
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
22 |
+
#venv_dir="venv"
|
23 |
+
|
24 |
+
# script to launch to start the app
|
25 |
+
#export LAUNCH_SCRIPT="launch.py"
|
26 |
+
|
27 |
+
# install command for torch
|
28 |
+
#export TORCH_COMMAND="pip install torch==1.12.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113"
|
29 |
+
|
30 |
+
# Requirements file to use for stable-diffusion-webui
|
31 |
+
#export REQS_FILE="requirements_versions.txt"
|
32 |
+
|
33 |
+
# Fixed git repos
|
34 |
+
#export K_DIFFUSION_PACKAGE=""
|
35 |
+
#export GFPGAN_PACKAGE=""
|
36 |
+
|
37 |
+
# Fixed git commits
|
38 |
+
#export STABLE_DIFFUSION_COMMIT_HASH=""
|
39 |
+
#export TAMING_TRANSFORMERS_COMMIT_HASH=""
|
40 |
+
#export CODEFORMER_COMMIT_HASH=""
|
41 |
+
#export BLIP_COMMIT_HASH=""
|
42 |
+
|
43 |
+
###########################################
|
webui.bat
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@echo off
|
2 |
+
|
3 |
+
if not defined PYTHON (set PYTHON=python)
|
4 |
+
if not defined VENV_DIR (set VENV_DIR=venv)
|
5 |
+
|
6 |
+
set ERROR_REPORTING=FALSE
|
7 |
+
|
8 |
+
mkdir tmp 2>NUL
|
9 |
+
|
10 |
+
%PYTHON% -c "" >tmp/stdout.txt 2>tmp/stderr.txt
|
11 |
+
if %ERRORLEVEL% == 0 goto :start_venv
|
12 |
+
echo Couldn't launch python
|
13 |
+
goto :show_stdout_stderr
|
14 |
+
|
15 |
+
:start_venv
|
16 |
+
if [%VENV_DIR%] == [-] goto :skip_venv
|
17 |
+
|
18 |
+
dir %VENV_DIR%\Scripts\Python.exe >tmp/stdout.txt 2>tmp/stderr.txt
|
19 |
+
if %ERRORLEVEL% == 0 goto :activate_venv
|
20 |
+
|
21 |
+
for /f "delims=" %%i in ('CALL %PYTHON% -c "import sys; print(sys.executable)"') do set PYTHON_FULLNAME="%%i"
|
22 |
+
echo Creating venv in directory %VENV_DIR% using python %PYTHON_FULLNAME%
|
23 |
+
%PYTHON_FULLNAME% -m venv %VENV_DIR% >tmp/stdout.txt 2>tmp/stderr.txt
|
24 |
+
if %ERRORLEVEL% == 0 goto :activate_venv
|
25 |
+
echo Unable to create venv in directory %VENV_DIR%
|
26 |
+
goto :show_stdout_stderr
|
27 |
+
|
28 |
+
:activate_venv
|
29 |
+
set PYTHON="%~dp0%VENV_DIR%\Scripts\Python.exe"
|
30 |
+
echo venv %PYTHON%
|
31 |
+
goto :launch
|
32 |
+
|
33 |
+
:skip_venv
|
34 |
+
|
35 |
+
:launch
|
36 |
+
%PYTHON% launch.py
|
37 |
+
pause
|
38 |
+
exit /b
|
39 |
+
|
40 |
+
:show_stdout_stderr
|
41 |
+
|
42 |
+
echo.
|
43 |
+
echo exit code: %errorlevel%
|
44 |
+
|
45 |
+
for /f %%i in ("tmp\stdout.txt") do set size=%%~zi
|
46 |
+
if %size% equ 0 goto :show_stderr
|
47 |
+
echo.
|
48 |
+
echo stdout:
|
49 |
+
type tmp\stdout.txt
|
50 |
+
|
51 |
+
:show_stderr
|
52 |
+
for /f %%i in ("tmp\stderr.txt") do set size=%%~zi
|
53 |
+
if %size% equ 0 goto :show_stderr
|
54 |
+
echo.
|
55 |
+
echo stderr:
|
56 |
+
type tmp\stderr.txt
|
57 |
+
|
58 |
+
:endofscript
|
59 |
+
|
60 |
+
echo.
|
61 |
+
echo Launch unsuccessful. Exiting.
|
62 |
+
pause
|
webui.py
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import threading
|
3 |
+
import time
|
4 |
+
import importlib
|
5 |
+
import signal
|
6 |
+
import threading
|
7 |
+
|
8 |
+
from fastapi.middleware.gzip import GZipMiddleware
|
9 |
+
|
10 |
+
from modules.paths import script_path
|
11 |
+
|
12 |
+
from modules import devices, sd_samplers
|
13 |
+
import modules.codeformer_model as codeformer
|
14 |
+
import modules.extras
|
15 |
+
import modules.face_restoration
|
16 |
+
import modules.gfpgan_model as gfpgan
|
17 |
+
import modules.img2img
|
18 |
+
|
19 |
+
import modules.lowvram
|
20 |
+
import modules.paths
|
21 |
+
import modules.scripts
|
22 |
+
import modules.sd_hijack
|
23 |
+
import modules.sd_models
|
24 |
+
import modules.shared as shared
|
25 |
+
import modules.txt2img
|
26 |
+
|
27 |
+
import modules.ui
|
28 |
+
from modules import devices
|
29 |
+
from modules import modelloader
|
30 |
+
from modules.paths import script_path
|
31 |
+
from modules.shared import cmd_opts
|
32 |
+
|
33 |
+
modelloader.cleanup_models()
|
34 |
+
modules.sd_models.setup_model()
|
35 |
+
codeformer.setup_model(cmd_opts.codeformer_models_path)
|
36 |
+
gfpgan.setup_model(cmd_opts.gfpgan_models_path)
|
37 |
+
shared.face_restorers.append(modules.face_restoration.FaceRestoration())
|
38 |
+
modelloader.load_upscalers()
|
39 |
+
queue_lock = threading.Lock()
|
40 |
+
|
41 |
+
|
42 |
+
def wrap_queued_call(func):
|
43 |
+
def f(*args, **kwargs):
|
44 |
+
with queue_lock:
|
45 |
+
res = func(*args, **kwargs)
|
46 |
+
|
47 |
+
return res
|
48 |
+
|
49 |
+
return f
|
50 |
+
|
51 |
+
|
52 |
+
def wrap_gradio_gpu_call(func, extra_outputs=None):
|
53 |
+
def f(*args, **kwargs):
|
54 |
+
devices.torch_gc()
|
55 |
+
|
56 |
+
shared.state.sampling_step = 0
|
57 |
+
shared.state.job_count = -1
|
58 |
+
shared.state.job_no = 0
|
59 |
+
shared.state.job_timestamp = shared.state.get_job_timestamp()
|
60 |
+
shared.state.current_latent = None
|
61 |
+
shared.state.current_image = None
|
62 |
+
shared.state.current_image_sampling_step = 0
|
63 |
+
shared.state.skipped = False
|
64 |
+
shared.state.interrupted = False
|
65 |
+
shared.state.textinfo = None
|
66 |
+
|
67 |
+
with queue_lock:
|
68 |
+
res = func(*args, **kwargs)
|
69 |
+
|
70 |
+
shared.state.job = ""
|
71 |
+
shared.state.job_count = 0
|
72 |
+
|
73 |
+
devices.torch_gc()
|
74 |
+
|
75 |
+
return res
|
76 |
+
|
77 |
+
return modules.ui.wrap_gradio_call(f, extra_outputs=extra_outputs)
|
78 |
+
|
79 |
+
|
80 |
+
modules.scripts.load_scripts(os.path.join(script_path, "scripts"))
|
81 |
+
|
82 |
+
shared.sd_model = modules.sd_models.load_model()
|
83 |
+
shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights(shared.sd_model)))
|
84 |
+
|
85 |
+
loaded_hypernetwork = modules.hypernetwork.load_hypernetwork(shared.opts.sd_hypernetwork)
|
86 |
+
shared.opts.onchange("sd_hypernetwork", wrap_queued_call(lambda: modules.hypernetwork.load_hypernetwork(shared.opts.sd_hypernetwork)))
|
87 |
+
|
88 |
+
|
89 |
+
def webui():
|
90 |
+
# make the program just exit at ctrl+c without waiting for anything
|
91 |
+
def sigint_handler(sig, frame):
|
92 |
+
print(f'Interrupted with signal {sig} in {frame}')
|
93 |
+
os._exit(0)
|
94 |
+
|
95 |
+
signal.signal(signal.SIGINT, sigint_handler)
|
96 |
+
|
97 |
+
while 1:
|
98 |
+
|
99 |
+
demo = modules.ui.create_ui(wrap_gradio_gpu_call=wrap_gradio_gpu_call)
|
100 |
+
|
101 |
+
app,local_url,share_url = demo.launch(
|
102 |
+
share=cmd_opts.share,
|
103 |
+
server_name="0.0.0.0" if cmd_opts.listen else None,
|
104 |
+
server_port=cmd_opts.port,
|
105 |
+
debug=cmd_opts.gradio_debug,
|
106 |
+
auth=[tuple(cred.split(':')) for cred in cmd_opts.gradio_auth.strip('"').split(',')] if cmd_opts.gradio_auth else None,
|
107 |
+
inbrowser=cmd_opts.autolaunch,
|
108 |
+
prevent_thread_lock=True
|
109 |
+
)
|
110 |
+
|
111 |
+
app.add_middleware(GZipMiddleware,minimum_size=1000)
|
112 |
+
|
113 |
+
while 1:
|
114 |
+
time.sleep(0.5)
|
115 |
+
if getattr(demo, 'do_restart', False):
|
116 |
+
time.sleep(0.5)
|
117 |
+
demo.close()
|
118 |
+
time.sleep(0.5)
|
119 |
+
break
|
120 |
+
|
121 |
+
sd_samplers.set_samplers()
|
122 |
+
|
123 |
+
print('Reloading Custom Scripts')
|
124 |
+
modules.scripts.reload_scripts(os.path.join(script_path, "scripts"))
|
125 |
+
print('Reloading modules: modules.ui')
|
126 |
+
importlib.reload(modules.ui)
|
127 |
+
print('Restarting Gradio')
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
if __name__ == "__main__":
|
132 |
+
webui()
|
webui.sh
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
#################################################
|
3 |
+
# Please do not make any changes to this file, #
|
4 |
+
# change the variables in webui-user.sh instead #
|
5 |
+
#################################################
|
6 |
+
# Read variables from webui-user.sh
|
7 |
+
# shellcheck source=/dev/null
|
8 |
+
if [[ -f webui-user.sh ]]
|
9 |
+
then
|
10 |
+
source ./webui-user.sh
|
11 |
+
fi
|
12 |
+
|
13 |
+
# Set defaults
|
14 |
+
# Install directory without trailing slash
|
15 |
+
if [[ -z "${install_dir}" ]]
|
16 |
+
then
|
17 |
+
install_dir="/home/$(whoami)"
|
18 |
+
fi
|
19 |
+
|
20 |
+
# Name of the subdirectory (defaults to stable-diffusion-webui)
|
21 |
+
if [[ -z "${clone_dir}" ]]
|
22 |
+
then
|
23 |
+
clone_dir="stable-diffusion-webui"
|
24 |
+
fi
|
25 |
+
|
26 |
+
# python3 executable
|
27 |
+
if [[ -z "${python_cmd}" ]]
|
28 |
+
then
|
29 |
+
python_cmd="python3"
|
30 |
+
fi
|
31 |
+
|
32 |
+
# git executable
|
33 |
+
if [[ -z "${GIT}" ]]
|
34 |
+
then
|
35 |
+
export GIT="git"
|
36 |
+
fi
|
37 |
+
|
38 |
+
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
39 |
+
if [[ -z "${venv_dir}" ]]
|
40 |
+
then
|
41 |
+
venv_dir="venv"
|
42 |
+
fi
|
43 |
+
|
44 |
+
if [[ -z "${LAUNCH_SCRIPT}" ]]
|
45 |
+
then
|
46 |
+
LAUNCH_SCRIPT="launch.py"
|
47 |
+
fi
|
48 |
+
|
49 |
+
# Disable sentry logging
|
50 |
+
export ERROR_REPORTING=FALSE
|
51 |
+
|
52 |
+
# Do not reinstall existing pip packages on Debian/Ubuntu
|
53 |
+
export PIP_IGNORE_INSTALLED=0
|
54 |
+
|
55 |
+
# Pretty print
|
56 |
+
delimiter="################################################################"
|
57 |
+
|
58 |
+
printf "\n%s\n" "${delimiter}"
|
59 |
+
printf "\e[1m\e[32mInstall script for stable-diffusion + Web UI\n"
|
60 |
+
printf "\e[1m\e[34mTested on Debian 11 (Bullseye)\e[0m"
|
61 |
+
printf "\n%s\n" "${delimiter}"
|
62 |
+
|
63 |
+
# Do not run as root
|
64 |
+
if [[ $(id -u) -eq 0 ]]
|
65 |
+
then
|
66 |
+
printf "\n%s\n" "${delimiter}"
|
67 |
+
printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"
|
68 |
+
printf "\n%s\n" "${delimiter}"
|
69 |
+
exit 1
|
70 |
+
else
|
71 |
+
printf "\n%s\n" "${delimiter}"
|
72 |
+
printf "Running on \e[1m\e[32m%s\e[0m user" "$(whoami)"
|
73 |
+
printf "\n%s\n" "${delimiter}"
|
74 |
+
fi
|
75 |
+
|
76 |
+
if [[ -d .git ]]
|
77 |
+
then
|
78 |
+
printf "\n%s\n" "${delimiter}"
|
79 |
+
printf "Repo already cloned, using it as install directory"
|
80 |
+
printf "\n%s\n" "${delimiter}"
|
81 |
+
install_dir="${PWD}/../"
|
82 |
+
clone_dir="${PWD##*/}"
|
83 |
+
fi
|
84 |
+
|
85 |
+
# Check prequisites
|
86 |
+
for preq in git python3
|
87 |
+
do
|
88 |
+
if ! hash "${preq}" &>/dev/null
|
89 |
+
then
|
90 |
+
printf "\n%s\n" "${delimiter}"
|
91 |
+
printf "\e[1m\e[31mERROR: %s is not installed, aborting...\e[0m" "${preq}"
|
92 |
+
printf "\n%s\n" "${delimiter}"
|
93 |
+
exit 1
|
94 |
+
fi
|
95 |
+
done
|
96 |
+
|
97 |
+
if ! "${python_cmd}" -c "import venv" &>/dev/null
|
98 |
+
then
|
99 |
+
printf "\n%s\n" "${delimiter}"
|
100 |
+
printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m"
|
101 |
+
printf "\n%s\n" "${delimiter}"
|
102 |
+
exit 1
|
103 |
+
fi
|
104 |
+
|
105 |
+
printf "\n%s\n" "${delimiter}"
|
106 |
+
printf "Clone or update stable-diffusion-webui"
|
107 |
+
printf "\n%s\n" "${delimiter}"
|
108 |
+
cd "${install_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/, aborting...\e[0m" "${install_dir}"; exit 1; }
|
109 |
+
if [[ -d "${clone_dir}" ]]
|
110 |
+
then
|
111 |
+
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
112 |
+
"${GIT}" pull
|
113 |
+
else
|
114 |
+
"${GIT}" clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "${clone_dir}"
|
115 |
+
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
116 |
+
fi
|
117 |
+
|
118 |
+
printf "\n%s\n" "${delimiter}"
|
119 |
+
printf "Create and activate python venv"
|
120 |
+
printf "\n%s\n" "${delimiter}"
|
121 |
+
cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
122 |
+
if [[ ! -d "${venv_dir}" ]]
|
123 |
+
then
|
124 |
+
"${python_cmd}" -m venv "${venv_dir}"
|
125 |
+
first_launch=1
|
126 |
+
fi
|
127 |
+
# shellcheck source=/dev/null
|
128 |
+
if [[ -f "${venv_dir}"/bin/activate ]]
|
129 |
+
then
|
130 |
+
source "${venv_dir}"/bin/activate
|
131 |
+
else
|
132 |
+
printf "\n%s\n" "${delimiter}"
|
133 |
+
printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m"
|
134 |
+
printf "\n%s\n" "${delimiter}"
|
135 |
+
exit 1
|
136 |
+
fi
|
137 |
+
|
138 |
+
printf "\n%s\n" "${delimiter}"
|
139 |
+
printf "Launching launch.py..."
|
140 |
+
printf "\n%s\n" "${delimiter}"
|
141 |
+
"${python_cmd}" "${LAUNCH_SCRIPT}"
|