Spaces:
Running
Running
fix outdated script issues
Browse files
app.py
CHANGED
|
@@ -2,92 +2,111 @@ import os
|
|
| 2 |
|
| 3 |
user_home = r"/home/user/app"
|
| 4 |
|
| 5 |
-
#
|
| 6 |
tmp_dir = os.path.join(user_home, "tmp")
|
| 7 |
os.makedirs(tmp_dir, exist_ok=True)
|
| 8 |
|
| 9 |
-
#
|
| 10 |
os.environ['TMPDIR'] = tmp_dir
|
| 11 |
os.environ['TEMP'] = tmp_dir
|
| 12 |
os.environ['TMP'] = tmp_dir
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
os.chdir(user_home)
|
| 15 |
-
|
|
|
|
| 16 |
print("cloning stable-diffusion-webui repo")
|
| 17 |
-
os.system("git clone \"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git\" "+user_home+r"/stable-diffusion-webui")
|
| 18 |
-
|
|
|
|
| 19 |
print("installing extensions")
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
os.system(r"
|
| 23 |
-
os.system(r"
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
os.system(r"
|
| 27 |
-
|
| 28 |
-
os.system(r"
|
| 29 |
-
os.system(r"git clone https://github.com/
|
| 30 |
-
os.system(r"git clone https://github.com/
|
| 31 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
os.system(r"git reset --hard")
|
| 33 |
-
os.system(r"git -C "+user_home+"/stable-diffusion-webui/repositories/stable-diffusion-stability-ai reset --hard")
|
| 34 |
|
| 35 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
print("downloading ControlNet models")
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 41 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 42 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 43 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 44 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 45 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 46 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 47 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 48 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 49 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 50 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 51 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/
|
| 52 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/
|
| 53 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/
|
| 54 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 55 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 56 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 57 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 58 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 59 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 60 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 61 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 62 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 63 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 64 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/
|
| 65 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/
|
| 66 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/
|
| 67 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/
|
| 68 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 69 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 70 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 71 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 72 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 73 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 74 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 75 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
| 76 |
-
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/
|
|
|
|
|
|
|
| 77 |
|
| 78 |
try:
|
| 79 |
-
os.
|
| 80 |
-
except
|
| 81 |
print("exist")
|
| 82 |
|
| 83 |
print("downloading model")
|
| 84 |
os.system(f"wget -q https://huggingface.co/FredZhang7/paint-journey-v2/resolve/main/paint_journey_v2_cpu_only.ckpt -O {user_home}/stable-diffusion-webui/models/Stable-diffusion/paint_journey_v2_cpu_only.ckpt")
|
| 85 |
os.system(f"wget -q https://huggingface.co/FredZhang7/paint-journey-v2/resolve/main/paint_journey_v2.vae.pt -O {user_home}/stable-diffusion-webui/models/Stable-diffusion/paint_journey_v2_cpu_only.vae.pt")
|
| 86 |
|
| 87 |
-
|
| 88 |
-
#strt webui
|
| 89 |
print("Done\nStarting Webui...")
|
| 90 |
-
os.system(r"python3 launch.py
|
| 91 |
-
|
| 92 |
|
| 93 |
-
del os
|
|
|
|
| 2 |
|
| 3 |
user_home = r"/home/user/app"
|
| 4 |
|
| 5 |
+
# Create temp directory for pip
|
| 6 |
tmp_dir = os.path.join(user_home, "tmp")
|
| 7 |
os.makedirs(tmp_dir, exist_ok=True)
|
| 8 |
|
| 9 |
+
# Set environment variable for all subsequent operations
|
| 10 |
os.environ['TMPDIR'] = tmp_dir
|
| 11 |
os.environ['TEMP'] = tmp_dir
|
| 12 |
os.environ['TMP'] = tmp_dir
|
| 13 |
|
| 14 |
+
# --- FIX: Set the STABLE_DIFFUSION_REPO to a working fork to avoid the 404 error ---
|
| 15 |
+
# The official Stability-AI repo is currently unavailable/404.
|
| 16 |
+
os.environ['STABLE_DIFFUSION_REPO'] = "https://github.com/w-e-w/stablediffusion.git"
|
| 17 |
+
|
| 18 |
os.chdir(user_home)
|
| 19 |
+
|
| 20 |
+
# Clone stable-diffusion-webui repo
|
| 21 |
print("cloning stable-diffusion-webui repo")
|
| 22 |
+
os.system("git clone \"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git\" " + user_home + r"/stable-diffusion-webui")
|
| 23 |
+
|
| 24 |
+
# Install extensions
|
| 25 |
print("installing extensions")
|
| 26 |
+
|
| 27 |
+
# --- FIX: Removed invalid "!git clone" syntax ---
|
| 28 |
+
os.system(r"git clone https://huggingface.co/embed/negative " + user_home + "/stable-diffusion-webui/embeddings/negative")
|
| 29 |
+
os.system(r"git clone https://huggingface.co/embed/lora " + user_home + "/stable-diffusion-webui/models/Lora/positive")
|
| 30 |
+
|
| 31 |
+
# --- FIX: Removed duplicated aria2c command string ---
|
| 32 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth -d " + user_home + "/stable-diffusion-webui/models/ESRGAN -o 4x-UltraSharp.pth")
|
| 33 |
+
|
| 34 |
+
os.system(r"wget https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py -O " + user_home + "/stable-diffusion-webui/scripts/run_n_times.py")
|
| 35 |
+
os.system(r"git clone https://github.com/AlUlkesh/stable-diffusion-webui-images-browser " + user_home + "/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser")
|
| 36 |
+
os.system(r"git clone https://github.com/camenduru/stable-diffusion-webui-huggingface " + user_home + "/stable-diffusion-webui/extensions/stable-diffusion-webui-huggingface")
|
| 37 |
+
os.system(r"git clone https://github.com/Mikubill/sd-webui-controlnet " + user_home + "/stable-diffusion-webui/extensions/sd-webui-controlnet")
|
| 38 |
+
os.system(r"git clone https://github.com/jexom/sd-webui-depth-lib " + user_home + "/stable-diffusion-webui/extensions/sd-webui-depth-lib")
|
| 39 |
+
os.system(r"git clone https://github.com/hnmr293/posex " + user_home + "/stable-diffusion-webui/extensions/posex")
|
| 40 |
+
os.system(r"git clone https://github.com/nonnonstop/sd-webui-3d-open-pose-editor " + user_home + "/stable-diffusion-webui/extensions/sd-webui-3d-open-pose-editor")
|
| 41 |
+
os.system(r"git clone https://github.com/imrayya/stable-diffusion-webui-Prompt_Generator " + user_home + "/stable-diffusion-webui/extensions/sd-webui-Prompt_Generator")
|
| 42 |
+
|
| 43 |
+
os.chdir(os.path.join(user_home, r"stable-diffusion-webui"))
|
| 44 |
os.system(r"git reset --hard")
|
|
|
|
| 45 |
|
| 46 |
+
# --- FIX: Pre-clone the stable-diffusion repository to ensure it exists before reset ---
|
| 47 |
+
repo_dir = os.path.join(user_home, "stable-diffusion-webui/repositories/stable-diffusion-stability-ai")
|
| 48 |
+
if not os.path.exists(repo_dir):
|
| 49 |
+
print("Pre-cloning Stable Diffusion repo fix...")
|
| 50 |
+
os.system(f"git clone https://github.com/w-e-w/stablediffusion.git {repo_dir}")
|
| 51 |
+
|
| 52 |
+
os.system(r"git -C " + repo_dir + " reset --hard")
|
| 53 |
+
|
| 54 |
+
# Download ControlNet models
|
| 55 |
print("downloading ControlNet models")
|
| 56 |
+
# (I'm leaving the loop unrolled as in your original code, but fixing the path concatenation typo if present)
|
| 57 |
+
cn_models_dir = user_home + "/stable-diffusion-webui/extensions/sd-webui-controlnet/models"
|
| 58 |
+
|
| 59 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors -d " + cn_models_dir + " -o control_v11e_sd15_ip2p_fp16.safetensors")
|
| 60 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors -d " + cn_models_dir + " -o control_v11e_sd15_shuffle_fp16.safetensors")
|
| 61 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_canny_fp16.safetensors")
|
| 62 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors -d " + cn_models_dir + " -o control_v11f1p_sd15_depth_fp16.safetensors")
|
| 63 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_inpaint_fp16.safetensors")
|
| 64 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_lineart_fp16.safetensors")
|
| 65 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_mlsd_fp16.safetensors")
|
| 66 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_normalbae_fp16.safetensors")
|
| 67 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_openpose_fp16.safetensors")
|
| 68 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_scribble_fp16.safetensors")
|
| 69 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_seg_fp16.safetensors")
|
| 70 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15_softedge_fp16.safetensors")
|
| 71 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors -d " + cn_models_dir + " -o control_v11p_sd15s2_lineart_anime_fp16.safetensors")
|
| 72 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors -d " + cn_models_dir + " -o control_v11f1e_sd15_tile_fp16.safetensors")
|
| 73 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml -d " + cn_models_dir + " -o control_v11e_sd15_ip2p_fp16.yaml")
|
| 74 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml -d " + cn_models_dir + " -o control_v11e_sd15_shuffle_fp16.yaml")
|
| 75 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_canny_fp16.yaml")
|
| 76 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml -d " + cn_models_dir + " -o control_v11f1p_sd15_depth_fp16.yaml")
|
| 77 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_inpaint_fp16.yaml")
|
| 78 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_lineart_fp16.yaml")
|
| 79 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_mlsd_fp16.yaml")
|
| 80 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_normalbae_fp16.yaml")
|
| 81 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_openpose_fp16.yaml")
|
| 82 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_scribble_fp16.yaml")
|
| 83 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_seg_fp16.yaml")
|
| 84 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15_softedge_fp16.yaml")
|
| 85 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml -d " + cn_models_dir + " -o control_v11p_sd15s2_lineart_anime_fp16.yaml")
|
| 86 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml -d " + cn_models_dir + " -o control_v11f1e_sd15_tile_fp16.yaml")
|
| 87 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_style_sd14v1.pth")
|
| 88 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_sketch_sd14v1.pth")
|
| 89 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_seg_sd14v1.pth")
|
| 90 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_openpose_sd14v1.pth")
|
| 91 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_keypose_sd14v1.pth")
|
| 92 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_depth_sd14v1.pth")
|
| 93 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd14v1.pth -d " + cn_models_dir + " -o t2iadapter_canny_sd14v1.pth")
|
| 94 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth -d " + cn_models_dir + " -o t2iadapter_canny_sd15v2.pth")
|
| 95 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth -d " + cn_models_dir + " -o t2iadapter_depth_sd15v2.pth")
|
| 96 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth -d " + cn_models_dir + " -o t2iadapter_sketch_sd15v2.pth")
|
| 97 |
+
os.system(r"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth -d " + cn_models_dir + " -o t2iadapter_zoedepth_sd15v1.pth")
|
| 98 |
|
| 99 |
try:
|
| 100 |
+
os.makedirs(os.path.join(user_home, "stable-diffusion-webui/models/Stable-diffusion"), exist_ok=True)
|
| 101 |
+
except FileExistsError:
|
| 102 |
print("exist")
|
| 103 |
|
| 104 |
print("downloading model")
|
| 105 |
os.system(f"wget -q https://huggingface.co/FredZhang7/paint-journey-v2/resolve/main/paint_journey_v2_cpu_only.ckpt -O {user_home}/stable-diffusion-webui/models/Stable-diffusion/paint_journey_v2_cpu_only.ckpt")
|
| 106 |
os.system(f"wget -q https://huggingface.co/FredZhang7/paint-journey-v2/resolve/main/paint_journey_v2.vae.pt -O {user_home}/stable-diffusion-webui/models/Stable-diffusion/paint_journey_v2_cpu_only.vae.pt")
|
| 107 |
|
| 108 |
+
# start webui
|
|
|
|
| 109 |
print("Done\nStarting Webui...")
|
| 110 |
+
os.system(r"python3 launch.py --precision full --ui-config-file /home/user/app/ui-config.json --ui-settings-file /home/user/app/config.json --no-half --no-half-vae --enable-insecure-extension-access --medvram --skip-torch-cuda-test")
|
|
|
|
| 111 |
|
| 112 |
+
del os, user_home
|