TheLastBen
commited on
Commit
•
55f804d
1
Parent(s):
23b20a2
Update Scripts/mainpaperspaceA1111.py
Browse files
Scripts/mainpaperspaceA1111.py
CHANGED
@@ -124,6 +124,52 @@ def mdl(Original_Model_Version, Path_to_MODEL, MODEL_LINK, safetensors, Temporar
|
|
124 |
return model
|
125 |
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
def sd(User, Password, Use_localtunnel):
|
128 |
|
129 |
auth=f"--gradio-auth {User}:{Password}"
|
|
|
124 |
return model
|
125 |
|
126 |
|
127 |
+
|
128 |
+
|
129 |
+
def CN(ControlNet_Model):
|
130 |
+
|
131 |
+
def download(url, model_dir):
|
132 |
+
|
133 |
+
filename = os.path.basename(urlparse(url).path)
|
134 |
+
pth = os.path.abspath(os.path.join(model_dir, filename))
|
135 |
+
if not os.path.exists(pth):
|
136 |
+
print('Downloading: '+os.path.basename(url))
|
137 |
+
download_url_to_file(url, pth, hash_prefix=None, progress=True)
|
138 |
+
else:
|
139 |
+
print(f"[1;32mThe model {filename} already exists[0m")
|
140 |
+
|
141 |
+
|
142 |
+
os.chdir('/notebooks/sd/stable-diffusion-webui/extensions')
|
143 |
+
if not os.path.exists("sd-webui-controlnet"):
|
144 |
+
call('git clone https://github.com/Mikubill/sd-webui-controlnet.git', shell=True)
|
145 |
+
os.chdir('/notebooks')
|
146 |
+
else:
|
147 |
+
os.chdir('sd-webui-controlnet')
|
148 |
+
call('git reset --hard', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
149 |
+
call('git pull', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
150 |
+
os.chdir('/notebooks')
|
151 |
+
|
152 |
+
mdldir="/notebooks/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/models"
|
153 |
+
|
154 |
+
call('wget -q -O CN_models.txt https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/CN_models.txt', shell=True)
|
155 |
+
with open("CN_models.txt", 'r') as f:
|
156 |
+
mdllnk = f.read().splitlines()
|
157 |
+
call('rm CN_models.txt', shell=True)
|
158 |
+
|
159 |
+
if ControlNet_Model == "All":
|
160 |
+
for lnk in mdllnk:
|
161 |
+
download(url=lnk, model_dir=mdldir)
|
162 |
+
clear_output()
|
163 |
+
done()
|
164 |
+
|
165 |
+
else:
|
166 |
+
download(mdllnk[int(ControlNet_Model)-1], mdldir)
|
167 |
+
clear_output()
|
168 |
+
done()
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
def sd(User, Password, Use_localtunnel):
|
174 |
|
175 |
auth=f"--gradio-auth {User}:{Password}"
|