File size: 10,502 Bytes
c725dcc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f218d0f
c725dcc
 
f218d0f
c725dcc
08e1b91
f218d0f
08e1b91
 
 
f218d0f
c725dcc
f218d0f
 
c725dcc
f218d0f
 
c725dcc
f218d0f
 
c725dcc
 
08e1b91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c725dcc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90db5a9
c725dcc
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
"""
Stable Diffusion Webui Version 1.32
https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/tag/v1.3.2

"""

import os
from sys import executable 
import subprocess
import pathlib
import gc

def Gitclone(URI:str,ClonePath:pathlib.Path ) -> int :
  if pathlib.Path.exists(ClonePath):
    return 0
  while True:
    i=subprocess.run([r"git",r"clone",str(URI),str(ClonePath)])
    if(i.returncode == 0 ): 
     del i
     gc.collect()
     return 0
    else :
     del i
def DownLoad(URI:str,DownloadPath:pathlib.Path,DownLoadFileName:str ) -> int:
  while (True):
    i=subprocess.run([r"aria2c",r"-c",r"-x" ,r"16", r"-s",r"16", r"-k" ,r"1M" ,r"-m",r"0",r"--enable-mmap=false",r"--console-log-level=error",r"-d",str(DownloadPath),r"-o",DownLoadFileName,URI]);
    if(i.returncode == 0 ): 
      del i
      gc.collect()
      return 0
    else :
      del i
user_home =pathlib.Path.home().resolve()
os.chdir(str(user_home))
#clone stable-diffusion-webui repo
print("cloning stable-diffusion-webui repo")
Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",user_home / r"stable-diffusion-webui")
os.chdir(str(user_home / r"stable-diffusion-webui"))
os.system("git reset --hard baf6946e06249c5af9851c60171692c44ef633e0") #Version 1.32
#install extensions
print("installing extensions")
Gitclone(r"https://huggingface.co/embed/negative",user_home / r"stable-diffusion-webui" / r"embeddings"  / r"negative")
Gitclone(r"https://huggingface.co/embed/lora",user_home / r"stable-diffusion-webui" / r"models" / r"Lora" / r"positive")
DownLoad(r"https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth",user_home / r"stable-diffusion-webui" / r"models" / r"ESRGAN" ,r"4x-UltraSharp.pth")
while (True):
   i=subprocess.run([r"wget",r"https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py",r"-O",str(user_home / r"stable-diffusion-webui" / r"scripts" / r"run_n_times.py")])
   if(i.returncode == 0 ): 
    del i
    gc.collect()
    break
   else :
    del i
Gitclone(r"https://github.com/deforum-art/deforum-for-automatic1111-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"deforum-for-automatic1111-webui" )
Gitclone(r"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",user_home / r"stable-diffusion-webui" / r"extensions"/ r"stable-diffusion-webui-images-browser")
Gitclone(r"https://github.com/camenduru/stable-diffusion-webui-huggingface",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-huggingface")
Gitclone(r"https://github.com/camenduru/sd-civitai-browser",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-civitai-browser")
Gitclone(r"https://github.com/kohya-ss/sd-webui-additional-networks",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks")
#中文本地化的请解除下一行的注释
#Gitclone(r"https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN.git",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-localization-zh_CN")
Gitclone(r"https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git" , user_home / r"stable-diffusion-webui" / r"extensions" / r"a1111-sd-webui-tagcomplete")
Gitclone(r"https://github.com/camenduru/sd-webui-tunnels",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-tunnels")
Gitclone(r"https://github.com/catppuccin/stable-diffusion-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-catppuccin")
Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-rembg")
Gitclone(r"https://github.com/ashen-sensored/stable-diffusion-webui-two-shot",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-two-shot")
#Gitclone(r"https://github.com/camenduru/sd_webui_stealth_pnginfo",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_webui_stealth_pnginfo")
os.chdir(user_home / r"stable-diffusion-webui")
#download ControlNet models

#Stable Diffusion Checkpoint Model
#chilloutmixni
#DownLoad(r"https://civitai.com/api/download/models/11745",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"chilloutmix_NiPrunedFp32Fix.safetensors")
#https://civitai.com/models/47274/xxmix9realistic
DownLoad(r"https://civitai.com/api/download/models/102222",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"xxmix9realistic_v40.safetensors")
#https://civitai.com/models/47130/realisian
#DownLoad(r"https://civitai.com/api/download/models/70157",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"realisian_v40.safetensors")
#anything version4.5
#DownLoad(r"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.5-pruned.ckpt",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"anything-v4.5-pruned.ckpt")
#DownLoad(r"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.0.vae.pt",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"anything-v4.0.vae.pt")
#AbyssOrangeMix2 sfw
#DownLoad(r"https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix2/AbyssOrangeMix2_sfw.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"AbyssOrangeMix2_sfw.safetensors")
#DownLoad(r"https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"orangemix.vae.pt")
#MeinaPastelV5
#DownLoad(r"https://huggingface.co/Meina/MeinaPastel/resolve/main/MeinaPastelV5%20-%20Baked%20VAE.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"MeinaPastelV5_BakedVAE.safetensors")
#DownLoad(r"https://huggingface.co/Meina/MeinaPastel/resolve/main/MeinaPastelV5%20-%20Without%20VAE.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"MeinaPastelV5_WithoutVAE.safetensors")

#Lora Model
#kdoll
DownLoad(r"https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb/releases/download/koreanDollLikeness/koreanDollLikeness_v15.safetensors",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"koreanDollLikeness_v15.safetensors")
DownLoad(r"https://github.com/wibus-wee/stable_diffusion_chilloutmix_ipynb/releases/download/koreanDollLikeness/koreanDollLikeness_v15.safetensors",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"koreanDollLikeness_v15.safetensors")
#chibi
DownLoad(r"https://civitai.com/api/download/models/32988",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"blindbox_v1_mix.safetensors")
DownLoad(r"https://civitai.com/api/download/models/32988",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"blindbox_v1_mix.safetensors")
#ryo ~ https://civitai.com/models/23746/yamada-ryou-bocchi-the-rock
DownLoad(r"https://civitai.com/api/download/models/68754",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"yamadaryounew.safetensors")
DownLoad(r"https://civitai.com/api/download/models/68754",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"yamadaryounew.safetensors")
#texas ~ https://civitai.com/models/7007/arknight-texas-willpower
DownLoad(r"https://civitai.com/api/download/models/8235",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"德克萨斯-意志【全身willpower,头head,】.safetensors")
DownLoad(r"https://civitai.com/api/download/models/8235",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"德克萨斯-意志【全身willpower,头head,】.safetensors")
#texas ~ https://civitai.com/models/6779
DownLoad(r"https://civitai.com/api/download/models/7974",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"Arknights-Texas the Omertosa.safetensors")
DownLoad(r"https://civitai.com/api/download/models/7974",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"Arknights-Texas the Omertosa.safetensors")
#Better Light
DownLoad(r"https://civitai.com/api/download/models/39885",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"Better_light.safetensors")
DownLoad(r"https://civitai.com/api/download/models/39885",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"Better_light.safetensors")
#LAS
DownLoad(r"https://civitai.com/api/download/models/21065",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"LAS.safetensors")
DownLoad(r"https://civitai.com/api/download/models/21065",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"LAS.safetensors")
#Backlighting
DownLoad(r"https://civitai.com/api/download/models/39164",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"backlighting.safetensors")
DownLoad(r"https://civitai.com/api/download/models/39164",user_home / r"stable-diffusion-webui" /  r"models"/ r"lora",r"backlighting.safetensors")
#GFPGAN Model
#detection Resnet50
DownLoad(r"https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"detection_Resnet50_Final.pth")
#parsing_parsenet
DownLoad(r"https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"parsing_parsenet.pth")
#GFPGANv1.4
DownLoad(r"https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"GFPGANv1.4.pth")
#strt Stable Diffusion Webui
print("Done\nStarting Webui...")
os.chdir(user_home / r"stable-diffusion-webui")
while True:
  ret=subprocess.run([executable ,user_home / r"stable-diffusion-webui" / r"launch.py",r"--precision",r"full",r"--no-half",r"--api",r"--no-half-vae",r"--enable-insecure-extension-access",r"--medvram",r"--skip-torch-cuda-test",r"--enable-console-prompts",r"--ui-settings-file="+str(pathlib.Path(__file__).parent /r"config.json")])
  if(ret.returncode == 0 ): 
    del ret
    gc.collect()
  else :
    del ret
del os ,user_home ,pyexecutable ,subprocess