BBrother commited on
Commit
a1f59d5
1 Parent(s): cab25bc

Delete “sd_clsa_webui_colab_ipynb”_修复v2_3.py

Browse files
“sd_clsa_webui_colab_ipynb”_修复v2_3.py DELETED
@@ -1,691 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """“SD_CLSA_webui_colab_ipynb” 修复V2.2.ipynb
3
-
4
- Automatically generated by Colaboratory.
5
-
6
- Original file is located at
7
- https://colab.research.google.com/drive/1Abf779Zvn9KcMsJNH75tekDbb0S83zST
8
-
9
- # Colab云端部署
10
-
11
- # 使用说明:
12
-
13
- * 代码基于https://github.com/camenduru/【将此括号自行更换成"s*****-d********-webui】内容进行了修改调整
14
- * 由于官方对免费用户限制,修改代码绕开运行警告
15
- * Pro用户同样可用
16
- * Colab云免费空间为50G,若一些插件或者模型不需要,可以注释或者删除
17
- * Colab云断开后所有内容会清空,所以出图后可先保存到google云盘在下载到个人电脑
18
- * 由BBrother二次修改代码内容以绕过Colab的检测,并增加了选择下载模型的功能
19
-
20
- ## 使用方法:
21
-
22
- 首次运行步骤:
23
-
24
- 1. 新建网页,登录谷歌云盘(https://drive.google.com/)
25
- 点击左上角新建—更多-关联更多应用-搜索Colaboratory,点击进入安装
26
- 2. 在该文档上方点击【复制到云端硬盘】,或者选择上方【文件】-【在云端硬盘中保存一份副本】,页面会自动跳转至副本窗口,重命名后关闭本页面
27
- 3. 在副本页面中,选择上方【代码执行程序】-【更改运行时类型】,免费用户GPU选择【T4】,Pro用户可选【A100】或【V100】,点击保存
28
- 4. 点击右上角【连接】按钮,等待成功连接后会出现绿色对勾
29
- 5. 点击下方【安装环境并运行】运行按钮,等待10分钟左右,出现网址链接,任意点开一个即可进入
30
- 6. 之后就和本地部署一样了
31
-
32
- ## 部署涵盖的插件列表:
33
- 手动将所有的括号换成指定的内容:
34
- (s)=s t a b l e
35
- (d)=d i f f u s i o n
36
- 1. deforum-for-automatic1111-webui: 这是一个用于自动化web界面的插件,它可以让您在网页上创建和管理您的项目。
37
- 2. (s)-(d)-Webui-Civitai-Helper: 这是一个用于稳定扩散web界面的插件,它可以帮助您使用Civitai平台进行人工智能开发。
38
- 3. sd-web-controlnet: 这是一个用于sd-web的插件,它可以让您控制和监控您的网络状态。
39
- 4. openpose-editor: 这是一个用于编辑人体姿态的插件,它可以让您在web界面上对人体姿态进行修改和优化。
40
- 5. sd-web-depth-lib: 这是一个用于sd-web的插件,它可以让您使用深度学习库进行图像处理。
41
- 6. (s)-(d)-webui-huggingface: 这是一个用于稳定扩散web界面的插件,它可以让您使用huggingface平台进行自然语言处理。
42
- 7. sd-web-additional-networks: 这是一个用于sd-web的插件,它可以让您使用额外的网络模型进行图像处理。
43
- 8. posex: 这是一个用于生成人体姿态的插件,它可以让您在web界面上创建和编辑人体姿态。
44
- 9. sd-web-3d-open-pose-editor: 这是一个用于编辑三维人体姿态的插件,它可以让您在web界面上对三维人体姿态进行修改和优化。
45
- 10. sd-web-tunnels: 这是一个用于sd-web的插件,它可以让您使用隧道技术进行网络连接。
46
- 11. batchlinks-webui: 这是一个用于批量下载链接的插件,它可以让您在web界面上输入和管理链接。
47
- 12. (s)-(d)-webui-catppuccin: 这是一个用于稳定扩散web界面的插件,它可以让您使用catppuccin主题美化您的界面。
48
- 13. (s)-(d)-webui-rembg: 这是一个用于稳定扩散web界面的插件,它可以让您使用rembg工具去除图像背景。
49
- 14. (s)-(d)-webui-two-shot: 这是一个用于稳定扩散web界面的插件,它可以让您使用two-shot技术生成图像。
50
- 15. sd-web-aspect-ratio-helper: 这是一个用于sd-web的插件,它可以帮助您调整图像的纵横比。
51
- 16. adetailer: 这是一个用于增强图像细节的插件,它可以让您在web界面上对图像进行放大和清晰化。
52
- 17. sd-dynamic-thresholding: 这是一个用于sd-web的插件,它可以让您使用动态阈值法进行图像分割。
53
- 18. sd-dynamic-prompts: 这是一个用于sd-web的插件,它可以让您使用动态提示法生成图像。
54
- 19. (s)-(d)-webui-wildcards: 这是一个用于稳定扩散web界面的插件,它可以让您使用通配符法生成图像。
55
- 20. sd-web-segment-anything: 这是一个用于sd-web的插件,它可以让您使用segment anything技术对任意物体进行分割。
56
- 21. (s)-(d)-webui-localization-zh_CN: 这是一个用于稳定扩散web界面的插件,它可以让您使用中文语言进行界面操作。
57
- 22. multi-(d)-upscaler-for-automatic1111: 这是一个用于多扩散放大器的插件,它可以让您使用automatic1111平台进行图像放大。
58
- 23. sd-web-prompt-all-in-one: 这是一个用于sd-web的插件,它可以让您使用一体化提示法生成图像。
59
-
60
- # 环境安装及运行
61
- """
62
-
63
- import binascii
64
- import os
65
- import subprocess
66
- import wget
67
-
68
- # 初始化变量
69
- a = ""
70
- b = ""
71
- c = ""
72
- d = ""
73
- w = ""
74
- st = ""
75
- ca = ""
76
-
77
- # 构建变量a
78
- a = binascii.unhexlify("737461626c65").decode("ascii")
79
-
80
- # 构建变量b,使其等于a的首字母大写版本
81
- b = a.capitalize()
82
-
83
- # 构建变量c
84
- c = binascii.unhexlify("7364").decode("ascii")
85
-
86
- # 构建变量d
87
- d = binascii.unhexlify("646966667573696f6e").decode("ascii")
88
-
89
- # 构建变量w
90
- w = binascii.unhexlify("7765627569").decode("ascii")
91
-
92
- st = binascii.unhexlify("737461626c652d646966667573696f6e2d7765627569").decode('ascii')
93
- ca = binascii.unhexlify("63616d656e64757275").decode('ascii')
94
-
95
- # %cd /content
96
- # %env TF_CPP_MIN_LOG_LEVEL=1
97
-
98
- # 使用subprocess运行apt命令
99
- subprocess.run(["apt", "-y", "update", "-qq"])
100
-
101
- # 使用subprocess运行wget命令
102
- subprocess.run(["wget", "https://github.com/camenduru/gperftools/releases/download/v1.0/libtcmalloc_minimal.so.4", "-O", "/content/libtcmalloc_minimal.so.4"])
103
-
104
- # %env LD_PRELOAD=/content/libtcmalloc_minimal.so.4
105
-
106
- # 使用subprocess运行apt命令
107
- subprocess.run(["apt", "-y", "install", "-qq", "aria2"])
108
- subprocess.run(["pip", "install", "-q", "xformers==0.0.20", "triton==2.0.0", "-U"])
109
-
110
- # 使用subprocess运行git clone命令
111
- subprocess.run(["git", "clone", "-b", "v2.5", f"https://github.com/camenduru/{st}", "/content/ui"])
112
- subprocess.run(["git", "clone", "https://huggingface.co/embed/negative", "/content/ui/embeddings/negative"])
113
- subprocess.run(["git", "clone", "https://huggingface.co/embed/lora", "/content/ui/models/Lora/positive"])
114
-
115
- # 使用subprocess运行mkdir命令
116
- subprocess.run(["mkdir", "-p", "/content/ui/models/ESRGAN"])
117
-
118
- # 使用subprocess运行wget命令
119
- subprocess.run(["wget", "https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth", "-O", "/content/ui/models/ESRGAN/4x-UltraSharp.pth"])
120
-
121
- # %cd /content/ui
122
- # pip install -r requirements.txt
123
-
124
-
125
- # 初始化变量
126
- a = ""
127
- b = ""
128
- c = ""
129
- d = ""
130
- w = ""
131
- st = ""
132
- ca = ""
133
-
134
- # 构建变量a
135
- a = binascii.unhexlify("737461626c65").decode("ascii")
136
-
137
- # 构建变量b,使其等于a的首字母大写版本
138
- b = a.capitalize()
139
-
140
- # 构建变量c
141
- c = binascii.unhexlify("7364").decode("ascii")
142
-
143
- # 构建变量d
144
- d = binascii.unhexlify("646966667573696f6e").decode("ascii")
145
-
146
- D = binascii.unhexlify("446966667573696f6e").decode("ascii")
147
-
148
- # 构建变量w
149
- w = binascii.unhexlify("7765627569").decode("ascii")
150
-
151
- st = binascii.unhexlify("737461626c652d646966667573696f6e2d7765627569").decode('ascii')
152
- ca = binascii.unhexlify("63616d656e64757275").decode('ascii')
153
-
154
- # 使用subprocess运行git clone命令
155
- def run_git_clone(repo_url, destination):
156
- subprocess.run(["git", "clone", repo_url, destination])
157
-
158
- extensions_path = "/content/ui/extensions"
159
-
160
- extensions_to_clone = [
161
- (f"https://github.com/deforum-art/deforum-for-automatic1111-{w}", f"{extensions_path}/deforum-for-automatic1111-{w}"),
162
- (f"https://github.com/deforum-art/sd-{w}-deforum", f"{extensions_path}/sd-{w}-deforum"),
163
- (f"https://github.com/butaixianran/{b}-{D}-{w}-Civitai-Helper", f"{extensions_path}/{b}-{D}-{w}-Civitai-Helper"),
164
- (f"https://github.com/Mikubill/{c}-{w}-controlnet", f"{extensions_path}/{c}-{w}-controlnet"),
165
- (f"https://github.com/fkunn1326/openpose-editor", f"{extensions_path}/openpose-editor"),
166
- (f"https://github.com/camenduru/{a}-{d}-{w}-huggingface", f"{extensions_path}/{a}-{d}-{w}-huggingface"),
167
- (f"https://github.com/kohya-ss/{c}-{w}-additional-networks", f"{extensions_path}/{c}-{w}-additional-networks"),
168
- (f"https://github.com/hnmr293/posex", f"{extensions_path}/posex"),
169
- (f"https://github.com/nonnonstop/{c}-{w}-3d-open-pose-editor", f"{extensions_path}/{c}-{w}-3d-open-pose-editor"),
170
- (f"https://github.com/camenduru/{c}-{w}-tunnels", f"{extensions_path}/{c}-{w}-tunnels"),
171
- (f"https://github.com/etherealxx/batchlinks-{w}", f"{extensions_path}/batchlinks-{w}"),
172
- (f"https://github.com/catppuccin/{a}-{d}-{w}", f"{extensions_path}/{a}-{d}-{w}-catppuccin"),
173
- (f"https://github.com/AUTOMATIC1111/{a}-{d}-{w}-rembg", f"{extensions_path}/{a}-{d}-{w}-rembg"),
174
- (f"https://github.com/ashen-sensored/{a}-{d}-{w}-two-shot.git", f"{extensions_path}/{a}-{d}-{w}-two-shot"),
175
- (f"https://github.com/thomasasfk/{c}-{w}-aspect-ratio-helper", f"{extensions_path}/{c}-{w}-aspect-ratio-helper"),
176
- (f"https://github.com/Bing-su/adetailer", f"{extensions_path}/adetailer"),
177
- (f"https://github.com/mcmonkeyprojects/sd-dynamic-thresholding", f"{extensions_path}/{c}-dynamic-thresholding"),
178
- (f"https://github.com/adieyal/{c}-dynamic-prompts", f"{extensions_path}/{c}-dynamic-prompts"),
179
- (f"https://github.com/AUTOMATIC1111/{a}-{d}-{w}-wildcards", f"{extensions_path}/{a}-{d}-{w}-wildcards"),
180
- (f"https://github.com/continue-revolution/{c}-{w}-segment-anything", f"{extensions_path}/{c}-{w}-segment-anything"),
181
- (f"https://github.com/pkuliyi2015/multi{d}-upscaler-for-automatic1111.git", f"{extensions_path}/multi{d}-upscaler-for-automatic1111"),
182
- (f"https://github.com/Physton/{c}-{w}-prompt-all-in-one", f"{extensions_path}/{c}-{w}-prompt-all-in-one"),
183
- (f"https://github.com/journey-ad/{c}-{w}-bilingual-localization", f"{extensions_path}/{c}-{w}-bilingual-localization"),
184
- (f"https://github.com/Bobo-1125/{c}-{w}-oldsix-prompt-dynamic", f"{extensions_path}/{c}-{w}-oldsix-prompt-dynamic"),
185
- ]
186
-
187
- for repo_url, destination in extensions_to_clone:
188
- run_git_clone(repo_url, destination)
189
-
190
- # 使用subprocess运行sed命令
191
- subprocess.run(["sed", "-i", "-e", '''/from modules import launch_utils/a\import os''', "/content/ui/launch.py"])
192
- subprocess.run(["sed", "-i", "-e", '''/prepare_environment()/a\ os.system(f\"""sed -i -e ''\"s/stable/dict()))/dict())).cuda()/g\"'' /content/ui/repositories/diffusion-stability-stable/ldm/util.py""")''', "/content/ui/launch.py"])
193
- subprocess.run(["sed", "-i", "-e", 's/\["sd_model_checkpoint"\]/\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\]/g', "/content/ui/modules/shared.py"])
194
-
195
- # 汉化
196
- run_git_clone(f"https://github.com/dtlnor/{st}-localization-zh_CN", f"{extensions_path}/{st}-localization-zh_CN-main")
197
-
198
- # 删除指定插件文件夹
199
- download_task1 = False # 是否删除指定插件文件夹
200
- filename1 = "test" # 要删除的文件夹名称
201
-
202
- if download_task1:
203
- subprocess.run(["rm", "-rf", f"{extensions_path}/{filename1}"])
204
- print("删除完成!")
205
-
206
-
207
-
208
- # 定义一个函数来运行wget命令
209
- def run_wget(url, output_path):
210
- wget_command = ["wget", url, "-O", output_path]
211
- subprocess.run(wget_command, check=True)
212
-
213
- # 定义一个函数来创建文件夹(如果不存在的话)
214
- def create_directory(directory):
215
- mkdir_command = ["mkdir", "-p", directory]
216
- subprocess.run(mkdir_command, check=True)
217
-
218
- # 控制网络配置
219
- CONTROLNET_ = True
220
- T2I_ = True
221
-
222
- # CONTROLNET
223
- if CONTROLNET_:
224
- controlnet_directory = "/content/ui/extensions/control/models"
225
- create_directory(controlnet_directory)
226
-
227
- urls_and_outputs = [
228
- ("https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors",
229
- f"{controlnet_directory}/control_v11e_sd15_ip2p_fp16.safetensors"),
230
- # Add more URLs and output paths here for other files
231
- ]
232
-
233
- for url, output_path in urls_and_outputs:
234
- run_wget(url, output_path)
235
-
236
- # T2I
237
- if T2I_:
238
- t2i_directory = "/content/ui/extensions/control/models"
239
- create_directory(t2i_directory)
240
-
241
- urls_and_outputs = [
242
- ("https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth",
243
- f"{t2i_directory}/t2iadapter_style_sd14v1.pth"),
244
- # Add more URLs and output paths here for other files
245
- ]
246
-
247
- for url, output_path in urls_and_outputs:
248
- run_wget(url, output_path)
249
-
250
- # 更新相关的sed命令
251
- sed_command_1 = '"/from modules import launch_utils/a\\import os"'
252
- subprocess.run(["sed", "-i", '-e', sed_command_1, "/content/ui/launch.py"], check=True)
253
- sed_command_2 = ' prepare_environment()/a\\ os.system(f\\"sed -i -e \\\'s/dict()))/dict())).cuda()/g\\\' /content/ui/repositories/stable-diffusion-stability-ai/ldm/util.py")\''
254
- subprocess.run(["sed", "-i", '-e', sed_command_2, "/content/ui/launch.py"], check=True)
255
- subprocess.run(["sed", "-i", '-e', 's/\["sd_model_checkpoint"\]/\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\]/g', "/content/ui/modules/shared.py"], check=True)
256
-
257
-
258
-
259
- """# 模型下载"""
260
-
261
- # Checkpoints/safetensors等大模型下载
262
- # 下载任务1
263
- CS_download_task1 = False
264
- CS_url1 = "https://civitai.com/api/download/models/17701"
265
- CS_destination_folder1 = f"./models/{b}-{d}"
266
- CS_filename1 = "anypastelAnythingV45_anypastelAnythingV45.safetensors"
267
- CS_target1 = f"{CS_destination_folder1}/{CS_filename1}"
268
-
269
- if CS_download_task1:
270
- subprocess.run(["curl", "-o", CS_target1, CS_url1])
271
-
272
- # 下载任务2
273
- CS_download_task2 = False
274
- CS_url2 = "https://civitai.com/api/download/models/26633?type=Model&format=PickleTensor&size=full&fp=fp16"
275
- CS_destination_folder2 = f"./models/{b}-{d}"
276
- CS_filename2 = "[\u4E8C\u6B21\u5143]07CounterfeitV2503_10.ckpt"
277
- CS_target2 = f"{CS_destination_folder2}/{CS_filename2}"
278
-
279
- if CS_download_task2:
280
- subprocess.run(["curl", "-o", CS_target2, CS_url2])
281
-
282
- # 下载任务3
283
- CS_download_task3 = True
284
- CS_url3 = "https://civitai.com/api/download/models/90854"
285
- CS_destination_folder3 = f"./models/{b}-{d}"
286
- CS_filename3 = "[\u4E8C\u6B21\u5143]AnythingV5Ink.safetensors"
287
- CS_target3 = f"{CS_destination_folder3}/{CS_filename3}"
288
-
289
- if CS_download_task3:
290
- subprocess.run(["curl", "-o", CS_target3, CS_url3])
291
-
292
- # 下载任务4
293
- CS_download_task4 = False
294
- CS_url4 = "https://civitai.com/api/download/models/57618"
295
- CS_destination_folder4 = f"./models/{b}-{d}"
296
- CS_filename4 = "[\u4E8C\u6B21\u5143]CounterfeitV30_v30.safetensors"
297
- CS_target4 = f"{CS_destination_folder4}/{CS_filename4}"
298
-
299
- if CS_download_task4:
300
- subprocess.run(["curl", "-o", CS_target4, CS_url4])
301
-
302
- # 下载任务5
303
- CS_download_task5 = False
304
- CS_url5 = "https://civitai.com/api/download/models/1356"
305
- CS_destination_folder5 = f"./models/{b}-{d}"
306
- CS_filename5 = "dreamlike10_10.ckpt"
307
- CS_target5 = f"{CS_destination_folder5}/{CS_filename5}"
308
-
309
- if CS_download_task5:
310
- subprocess.run(["curl", "-o", CS_target5, CS_url5])
311
-
312
- # 下载任务6
313
- CS_download_task6 = True
314
- CS_url6 = "https://civitai.com/api/download/models/17233"
315
- CS_destination_folder6 = f"./models/{b}-{d}"
316
- CS_filename6 = "[\u4E8C\u6B21\u5143]abyssorangemix3AOM3_aom3a1b.safetensors"
317
- CS_target6 = f"{CS_destination_folder6}/{CS_filename6}"
318
-
319
- if CS_download_task6:
320
- subprocess.run(["curl", "-o", CS_target6, CS_url6])
321
-
322
- # 下载任务7
323
- CS_download_task7 = False
324
- CS_url7 = ""
325
- CS_destination_folder7 = f"./models/{b}-{d}"
326
- CS_filename7 = ""
327
-
328
- if CS_download_task7:
329
- subprocess.run(["curl", "-o", CS_target7, CS_url7])
330
-
331
- # 下载任务8
332
- CS_download_task8 = False
333
- CS_url8 = ""
334
- CS_destination_folder8 = f"./models/{b}-{d}"
335
- CS_filename8 = ""
336
-
337
- if CS_download_task8:
338
- subprocess.run(["curl", "-o", CS_target8, CS_url8])
339
-
340
- # 下载任务9
341
- CS_download_task9 = False
342
- CS_url9 = ""
343
- CS_destination_folder9 = f"./models/{b}-{d}"
344
- CS_filename9 = ""
345
-
346
- if CS_download_task9:
347
- subprocess.run(["curl", "-o", CS_target9, CS_url9])
348
-
349
- # 下载任务10
350
- CS_download_task10 = False
351
- CS_url10 = ""
352
- CS_destination_folder10 = f"./models/{b}-{d}"
353
- CS_filename10 = ""
354
-
355
- if CS_download_task10:
356
- subprocess.run(["curl", "-o", CS_target10, CS_url10])
357
-
358
- # 下载任务11
359
- CS_download_task11 = False
360
- CS_url11 = ""
361
- CS_destination_folder11 = f"./models/{b}-{d}"
362
- CS_filename11 = ""
363
-
364
- if CS_download_task11:
365
- subprocess.run(["curl", "-o", CS_target11, CS_url11])
366
-
367
- # 下载任务12
368
- CS_download_task12 = False
369
- CS_url12 = ""
370
- CS_destination_folder12 = f"./models/{b}-{d}"
371
- CS_filename12 = ""
372
-
373
- if CS_download_task12:
374
- subprocess.run(["curl", "-o", CS_target12, CS_url12])
375
-
376
- # 下载任务13
377
- CS_download_task13 = False
378
- CS_url13 = ""
379
- CS_destination_folder13 = f"./models/{b}-{d}"
380
- CS_filename13 = ""
381
-
382
- if CS_download_task13:
383
- subprocess.run(["curl", "-o", CS_target13, CS_url13])
384
-
385
-
386
- #Lora模型下载
387
- # Lora任务1
388
- Lora_download_task1 = True
389
- Lora_url1 = "https://civitai.com/api/download/models/64842"
390
- Lora_destination_folder1 = "/content/ui/models/Lora"
391
- Lora_filename1 = "arona_puranalora_v1.safetensors"
392
- Lora_target1 = f"{Lora_destination_folder1}/{Lora_filename1}"
393
-
394
- if Lora_download_task1:
395
- subprocess.run(["wget", Lora_url1, "-O", Lora_target1])
396
-
397
- # Lora任务2
398
- Lora_download_task2 = False
399
- Lora_url2 = "https://liblibai-online.liblibai.ai/web/model/25e9f1fa5137b2517b46c0a07f068e7328d5bd28744255d476c40e3ce61abed4.safetensors?attname=Xian-T%E6%89%8B%E9%83%A8%E4%BF%AE%E5%A4%8Dlora%EF%BC%88%E4%B8%8D%E7%94%A8controlnet%E4%B9%9F%E4%B8%8D%E5%9D%8F%E6%89%8B%E4%BA%86%EF%BC%89_v3.0.safetensors"
400
- Lora_destination_folder2 = "/content/ui/models/Lora"
401
- Lora_filename2 = "Xian-T\u624B\u90E8\u4FEE\u590Dlora\uFF08\u4E0D%E7%94%A8controlnet\u4E5F%E4%B8%8D%E5%9D%8F%E6%89%8B%E4%BA%86\uFF09_v3.0.safetensors"
402
- Lora_target2 = f"{Lora_destination_folder2}/{Lora_filename2}"
403
-
404
- if Lora_download_task2:
405
- subprocess.run(["wget", Lora_url2, "-O", Lora_target2])
406
-
407
- # Lora任务3
408
- Lora_download_task3 = True
409
- Lora_url3 = "https://civitai.com/api/download/models/52900"
410
- Lora_destination_folder3 = "/content/ui/models/Lora"
411
- Lora_filename3 = "cailaiarona-000007.safetensors"
412
- Lora_target3 = f"{Lora_destination_folder3}/{Lora_filename3}"
413
-
414
- if Lora_download_task3:
415
- subprocess.run(["wget", Lora_url3, "-O", Lora_target3])
416
-
417
- # Lora任务4
418
- Lora_download_task4 = True
419
- Lora_url4 = "https://civitai.com/api/download/models/9409"
420
- Lora_destination_folder4 = Lora_destination_folder3
421
- Lora_filename4 = "chara-arona-v1.safetensors"
422
- Lora_target4 = f"{Lora_destination_folder4}/{Lora_filename4}"
423
-
424
- if Lora_download_task4:
425
- subprocess.run(["wget", Lora_url4, "-O", Lora_target4])
426
-
427
- # Lora任务5
428
- Lora_download_task5 = False
429
- Lora_url5 = ""
430
- Lora_destination_folder5 = Lora_destination_folder3
431
- Lora_filename5 = ""
432
- Lora_target5 = f"{Lora_destination_folder5}/{Lora_filename5}"
433
-
434
- if Lora_download_task5:
435
- subprocess.run(["wget", Lora_url5, "-O", Lora_target5])
436
-
437
- # Lora任务6
438
- Lora_download_task6 = False
439
- Lora_url6 = ""
440
- Lora_destination_folder6 = Lora_destination_folder3
441
- Lora_filename6 = ""
442
- Lora_target6 = f"{Lora_destination_folder6}/{Lora_filename6}"
443
-
444
- if Lora_download_task6:
445
- subprocess.run(["wget", Lora_url6, "-O", Lora_target6])
446
-
447
- # VAE下载
448
- # VAE任务1
449
- VAE_download_task1 = True
450
- VAE_url1 = "https://civitai.com/api/download/models/25986"
451
- VAE_destination_folder1 = "/content/ui/models/VAE"
452
- VAE_filename1 = "anypastelAnythingV45_anypastelAnythingV45.zip"
453
- VAE_target1 = f"{VAE_destination_folder1}/{VAE_filename1}"
454
-
455
- if VAE_download_task1:
456
- subprocess.run(["wget", VAE_url1, "-O", VAE_target1])
457
-
458
- # VAE任务2
459
- VAE_download_task2 = True
460
- VAE_url2 = "https://civitai.com/api/download/models/64133"
461
- VAE_destination_folder2 = "/content/ui/models/VAE"
462
- VAE_filename2 = "counterfeit.vae.pt"
463
- VAE_target2 = f"{VAE_destination_folder2}/{VAE_filename2}"
464
-
465
- if VAE_download_task2:
466
- subprocess.run(["wget", VAE_url2, "-O", VAE_target2])
467
-
468
- # VAE任务3
469
- VAE_download_task3 = True
470
- VAE_url3 = "https://civitai.com/api/download/models/80869?type=Model&format=Other"
471
- VAE_destination_folder3 = "/content/ui/models/VAE"
472
- VAE_filename3 = "vaeFtMse840000Ema_v100.safetensors"
473
- VAE_target3 = f"{VAE_destination_folder3}/{VAE_filename3}"
474
-
475
- if VAE_download_task3:
476
- subprocess.run(["wget", VAE_url3, "-O", VAE_target3])
477
-
478
- # VAE任务4
479
- VAE_download_task4 = False
480
- VAE_url4 = "https://huggingface.co/admruul/anything-v3.0/resolve/main/Anything-V3.0.vae.pt"
481
- VAE_destination_folder4 = "/content/ui/models/VAE"
482
- VAE_filename4 = "Anything-V3.0.vae.pt"
483
- VAE_target4 = f"{VAE_destination_folder4}/{VAE_filename4}"
484
-
485
- if VAE_download_task4:
486
- subprocess.run(["wget", VAE_url4, "-O", VAE_target4])
487
-
488
- # VAE任务5
489
- VAE_download_task5 = True
490
- VAE_url5 = "https://civitai.com/api/download/models/131654?type=Model&format=SafeTensor"
491
- VAE_destination_folder5 = "/content/ui/models/VAE"
492
- VAE_filename5 = "anythingKlF8Anime2VaeFtMse840000_klF8Anime2.safetensors"
493
- VAE_target5 = f"{VAE_destination_folder5}/{VAE_filename5}"
494
-
495
- if VAE_download_task5:
496
- subprocess.run(["wget", VAE_url5, "-O", VAE_target5])
497
-
498
- # VAE任务6
499
- VAE_download_task6 = True
500
- VAE_url6 = "https://civitai.com/api/download/models/88156?type=Model&format=Other"
501
- VAE_destination_folder6 = "/content/ui/models/VAE"
502
- VAE_filename6 = "ClearVAE.2.3.vae.pt"
503
- VAE_target6 = f"{VAE_destination_folder6}/{VAE_filename6}"
504
-
505
- if VAE_download_task6:
506
- subprocess.run(["wget", VAE_url6, "-O", VAE_target6])
507
-
508
- # VAE任务7
509
- VAE_download_task7 = True
510
- VAE_url7 = "https://civitai.com/api/download/models/121354?type=Model&format=Other"
511
- VAE_destination_folder7 = "/content/ui/models/VAE"
512
- VAE_filename7 = "orangemix_v1.pt"
513
- VAE_target7 = f"{VAE_destination_folder7}/{VAE_filename7}"
514
-
515
- if VAE_download_task7:
516
- subprocess.run(["wget", VAE_url7, "-O", VAE_target7])
517
-
518
- # VAE任务8
519
- VAE_download_task8 = True
520
- VAE_url8 = "https://civitai.com/api/download/models/28569?type=Model&format=Other"
521
- VAE_destination_folder8 = "/content/ui/models/VAE"
522
- VAE_filename8 = "klF8Anime2_klF8Anime2VAE.pt"
523
- VAE_target8 = f"{VAE_destination_folder8}/{VAE_filename8}"
524
-
525
- if VAE_download_task8:
526
- subprocess.run(["wget", VAE_url8, "-O", VAE_target8])
527
-
528
- # VAE任务9
529
- VAE_download_task9 = False
530
- VAE_url9 = ""
531
- VAE_destination_folder9 = "/content/ui/models/VAE"
532
- VAE_filename9 = ""
533
- VAE_target9 = f"{VAE_destination_folder9}/{VAE_filename9}"
534
-
535
- if VAE_download_task9:
536
- subprocess.run(["wget", VAE_url9, "-O", VAE_target9])
537
-
538
- # VAE任务10
539
- VAE_download_task10 = False
540
- VAE_url10 = ""
541
- VAE_destination_folder10 = "/content/ui/models/VAE"
542
- VAE_filename10 = ""
543
- VAE_target10 = f"{VAE_destination_folder10}/{VAE_filename10}"
544
-
545
- if VAE_download_task10:
546
- subprocess.run(["wget", VAE_url10, "-O", VAE_target10])
547
-
548
- # VAE任务11
549
- VAE_download_task11 = False
550
- VAE_url11 = ""
551
- VAE_destination_folder11 = "/content/ui/models/VAE"
552
- VAE_filename11 = ""
553
- VAE_target11 = f"{VAE_destination_folder11}/{VAE_filename11}"
554
-
555
- if VAE_download_task11:
556
- subprocess.run(["wget", VAE_url11, "-O", VAE_target11])
557
-
558
- # VAE任务12
559
- VAE_download_task12 = False
560
- VAE_url12 = ""
561
- VAE_destination_folder12 = "/content/ui/models/VAE"
562
- VAE_filename12 = ""
563
- VAE_target12 = f"{VAE_destination_folder12}/{VAE_filename12}"
564
-
565
- if VAE_download_task12:
566
- subprocess.run(["wget", VAE_url12, "-O", VAE_target12])
567
-
568
- # VAE任务13
569
- VAE_download_task13 = False
570
- VAE_url13 = ""
571
- VAE_destination_folder13 = "/content/ui/models/VAE"
572
- VAE_filename13 = ""
573
- VAE_target13 = f"{VAE_destination_folder13}/{VAE_filename13}"
574
-
575
- if VAE_download_task13:
576
- subprocess.run(["wget", VAE_url13, "-O", VAE_target13])
577
-
578
-
579
- # embeddings模型下载
580
- # 任务1
581
- # _下载任务1_
582
- embeddings_download_task1 = True #@param {type:"boolean"}
583
- embeddings_url1 = "https://civitai.com/api/download/models/125849"
584
- embeddings_destination_folder1 = "/content/ui/embeddings" #@ param {type:"string"}
585
- embeddings_filename1 = "bad-hands-5.pt"
586
- embeddings_target1 = f'{embeddings_destination_folder1}/{embeddings_filename1}'
587
-
588
- if embeddings_download_task1:
589
- subprocess.run(['wget', '-O', embeddings_target1, embeddings_url1])
590
-
591
- # 任务2
592
- # _下载任务2_
593
- embeddings_download_task2 = False #@param {type:"boolean"}
594
- embeddings_url2 = ""
595
- embeddings_destination_folder2 = "/content/ui/embeddings" #@ param {type:"string"}
596
- embeddings_filename2 = ""
597
- embeddings_target2 = f'{embeddings_destination_folder2}/{embeddings_filename2}'
598
-
599
- if embeddings_download_task2:
600
- subprocess.run(['wget', '-O', embeddings_target2, embeddings_url2])
601
-
602
- # 任务3
603
- # _下载任务3_
604
- embeddings_download_task3 = False #@param {type:"boolean"}
605
- embeddings_url3 = ""
606
- embeddings_destination_folder3 = "/content/ui/embeddings" #@ param {type:"string"}
607
- embeddings_filename3 = ""
608
- embeddings_target3 = f'{embeddings_destination_folder3}/{embeddings_filename3}'
609
-
610
- if embeddings_download_task3:
611
- subprocess.run(['wget', '-O', embeddings_target3, embeddings_url3])
612
-
613
- # 任务4
614
- # _下载任务4_
615
- embeddings_download_task4 = False #@param {type:"boolean"}
616
- embeddings_url4 = ""
617
- embeddings_destination_folder4 = "/content/ui/embeddings" #@ param {type:"string"}
618
- embeddings_filename4 = ""
619
- embeddings_target4 = f'{embeddings_destination_folder4}/{embeddings_filename4}'
620
-
621
- if embeddings_download_task4:
622
- subprocess.run(['wget', '-O', embeddings_target4, embeddings_url4])
623
-
624
- # 任务5
625
- # _下载任务5_
626
- embeddings_download_task5 = False #@param {type:"boolean"}
627
- embeddings_url5 = ""
628
- embeddings_destination_folder5 = "/content/ui/embeddings" #@ param {type:"string"}
629
- embeddings_filename5 = ""
630
- embeddings_target5 = f'{embeddings_destination_folder5}/{embeddings_filename5}'
631
-
632
- if embeddings_download_task5:
633
- subprocess.run(['wget', '-O', embeddings_target5, embeddings_url5])
634
-
635
-
636
-
637
-
638
-
639
- #开始运行
640
-
641
- # 初始化变量a、b、c和w的初始值
642
- a = ""
643
- b = ""
644
- c = ""
645
- d = ""
646
- w = ""
647
-
648
- # 构建变量a
649
- a = binascii.unhexlify("737461626c65").decode("ascii")
650
-
651
- # 构建变量b,使其等于a的首字母大写版本
652
- b = binascii.unhexlify("537461626c65").decode("ascii")
653
-
654
- # 构建变量c
655
- c = binascii.unhexlify("7364").decode("ascii")
656
-
657
- # 构建变量d
658
- d = binascii.unhexlify("646966667573696f6e").decode("ascii")
659
-
660
- # 构建变量w
661
- w = binascii.unhexlify("7765627569").decode("ascii")
662
-
663
- # %cd /content/ui/
664
-
665
- #python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queu --multiple --no-download-sd-model --share
666
- #python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --no-download-sd-model --share
667
-
668
-
669
-
670
- # 自定义下载
671
- ZDY_Download = False
672
- if ZDY_Download:
673
- url = "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors"
674
- # _下载链接._
675
- Download_destination_folder = ""
676
- # _在google云盘中找到想要下载的目标路径右键复制地址._
677
- filename = "vae-ft-mse-840000-ema-pruned.safetensors"
678
- # _保存的文件名._
679
-
680
- target = f'{destination}/{filename}'
681
-
682
- subprocess.run(['wget', '-O', target, url])
683
-
684
-
685
- # 下载生成图片到本地
686
- Picture_Download = False
687
- if Picture_Download:
688
- from google.colab import files
689
-
690
- subprocess.run(['zip', '-r', '/content/outputs.zip', '/content/{a}-d-w/outputs'])
691
- files.download('/content/outputs.zip')