BBrother commited on
Commit
fee2f06
1 Parent(s): a3b6362

Delete “sd_clsa_webui_colab_ipynb”_修复v2_3.py

Browse files
“sd_clsa_webui_colab_ipynb”_修复v2_3.py DELETED
@@ -1,695 +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
-
254
- 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")\''
255
- subprocess.run(["sed", "-i", '-e', sed_command_2, "/content/ui/launch.py"], check=True)
256
-
257
- sed_command_3 = 's/\\["sd_model_checkpoint"\\]/\\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\\]/g'
258
- subprocess.run(["sed", "-i", '-e', sed_command_3, "/content/ui/modules/shared.py"], check=True)
259
-
260
-
261
-
262
-
263
- """# 模型下载"""
264
-
265
- # Checkpoints/safetensors等大模型下载
266
- # 下载任务1
267
- CS_download_task1 = False
268
- CS_url1 = "https://civitai.com/api/download/models/17701"
269
- CS_destination_folder1 = f"./models/{b}-{d}"
270
- CS_filename1 = "anypastelAnythingV45_anypastelAnythingV45.safetensors"
271
- CS_target1 = f"{CS_destination_folder1}/{CS_filename1}"
272
-
273
- if CS_download_task1:
274
- subprocess.run(["curl", "-o", CS_target1, CS_url1])
275
-
276
- # 下载任务2
277
- CS_download_task2 = False
278
- CS_url2 = "https://civitai.com/api/download/models/26633?type=Model&format=PickleTensor&size=full&fp=fp16"
279
- CS_destination_folder2 = f"./models/{b}-{d}"
280
- CS_filename2 = "[\u4E8C\u6B21\u5143]07CounterfeitV2503_10.ckpt"
281
- CS_target2 = f"{CS_destination_folder2}/{CS_filename2}"
282
-
283
- if CS_download_task2:
284
- subprocess.run(["curl", "-o", CS_target2, CS_url2])
285
-
286
- # 下载任务3
287
- CS_download_task3 = True
288
- CS_url3 = "https://civitai.com/api/download/models/90854"
289
- CS_destination_folder3 = f"./models/{b}-{d}"
290
- CS_filename3 = "[\u4E8C\u6B21\u5143]AnythingV5Ink.safetensors"
291
- CS_target3 = f"{CS_destination_folder3}/{CS_filename3}"
292
-
293
- if CS_download_task3:
294
- subprocess.run(["curl", "-o", CS_target3, CS_url3])
295
-
296
- # 下载任务4
297
- CS_download_task4 = False
298
- CS_url4 = "https://civitai.com/api/download/models/57618"
299
- CS_destination_folder4 = f"./models/{b}-{d}"
300
- CS_filename4 = "[\u4E8C\u6B21\u5143]CounterfeitV30_v30.safetensors"
301
- CS_target4 = f"{CS_destination_folder4}/{CS_filename4}"
302
-
303
- if CS_download_task4:
304
- subprocess.run(["curl", "-o", CS_target4, CS_url4])
305
-
306
- # 下载任务5
307
- CS_download_task5 = False
308
- CS_url5 = "https://civitai.com/api/download/models/1356"
309
- CS_destination_folder5 = f"./models/{b}-{d}"
310
- CS_filename5 = "dreamlike10_10.ckpt"
311
- CS_target5 = f"{CS_destination_folder5}/{CS_filename5}"
312
-
313
- if CS_download_task5:
314
- subprocess.run(["curl", "-o", CS_target5, CS_url5])
315
-
316
- # 下载任务6
317
- CS_download_task6 = True
318
- CS_url6 = "https://civitai.com/api/download/models/17233"
319
- CS_destination_folder6 = f"./models/{b}-{d}"
320
- CS_filename6 = "[\u4E8C\u6B21\u5143]abyssorangemix3AOM3_aom3a1b.safetensors"
321
- CS_target6 = f"{CS_destination_folder6}/{CS_filename6}"
322
-
323
- if CS_download_task6:
324
- subprocess.run(["curl", "-o", CS_target6, CS_url6])
325
-
326
- # 下载任务7
327
- CS_download_task7 = False
328
- CS_url7 = ""
329
- CS_destination_folder7 = f"./models/{b}-{d}"
330
- CS_filename7 = ""
331
-
332
- if CS_download_task7:
333
- subprocess.run(["curl", "-o", CS_target7, CS_url7])
334
-
335
- # 下载任务8
336
- CS_download_task8 = False
337
- CS_url8 = ""
338
- CS_destination_folder8 = f"./models/{b}-{d}"
339
- CS_filename8 = ""
340
-
341
- if CS_download_task8:
342
- subprocess.run(["curl", "-o", CS_target8, CS_url8])
343
-
344
- # 下载任务9
345
- CS_download_task9 = False
346
- CS_url9 = ""
347
- CS_destination_folder9 = f"./models/{b}-{d}"
348
- CS_filename9 = ""
349
-
350
- if CS_download_task9:
351
- subprocess.run(["curl", "-o", CS_target9, CS_url9])
352
-
353
- # 下载任务10
354
- CS_download_task10 = False
355
- CS_url10 = ""
356
- CS_destination_folder10 = f"./models/{b}-{d}"
357
- CS_filename10 = ""
358
-
359
- if CS_download_task10:
360
- subprocess.run(["curl", "-o", CS_target10, CS_url10])
361
-
362
- # 下载任务11
363
- CS_download_task11 = False
364
- CS_url11 = ""
365
- CS_destination_folder11 = f"./models/{b}-{d}"
366
- CS_filename11 = ""
367
-
368
- if CS_download_task11:
369
- subprocess.run(["curl", "-o", CS_target11, CS_url11])
370
-
371
- # 下载任务12
372
- CS_download_task12 = False
373
- CS_url12 = ""
374
- CS_destination_folder12 = f"./models/{b}-{d}"
375
- CS_filename12 = ""
376
-
377
- if CS_download_task12:
378
- subprocess.run(["curl", "-o", CS_target12, CS_url12])
379
-
380
- # 下载任务13
381
- CS_download_task13 = False
382
- CS_url13 = ""
383
- CS_destination_folder13 = f"./models/{b}-{d}"
384
- CS_filename13 = ""
385
-
386
- if CS_download_task13:
387
- subprocess.run(["curl", "-o", CS_target13, CS_url13])
388
-
389
-
390
- #Lora模型下载
391
- # Lora任务1
392
- Lora_download_task1 = True
393
- Lora_url1 = "https://civitai.com/api/download/models/64842"
394
- Lora_destination_folder1 = "/content/ui/models/Lora"
395
- Lora_filename1 = "arona_puranalora_v1.safetensors"
396
- Lora_target1 = f"{Lora_destination_folder1}/{Lora_filename1}"
397
-
398
- if Lora_download_task1:
399
- subprocess.run(["wget", Lora_url1, "-O", Lora_target1])
400
-
401
- # Lora任务2
402
- Lora_download_task2 = False
403
- 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"
404
- Lora_destination_folder2 = "/content/ui/models/Lora"
405
- 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"
406
- Lora_target2 = f"{Lora_destination_folder2}/{Lora_filename2}"
407
-
408
- if Lora_download_task2:
409
- subprocess.run(["wget", Lora_url2, "-O", Lora_target2])
410
-
411
- # Lora任务3
412
- Lora_download_task3 = True
413
- Lora_url3 = "https://civitai.com/api/download/models/52900"
414
- Lora_destination_folder3 = "/content/ui/models/Lora"
415
- Lora_filename3 = "cailaiarona-000007.safetensors"
416
- Lora_target3 = f"{Lora_destination_folder3}/{Lora_filename3}"
417
-
418
- if Lora_download_task3:
419
- subprocess.run(["wget", Lora_url3, "-O", Lora_target3])
420
-
421
- # Lora任务4
422
- Lora_download_task4 = True
423
- Lora_url4 = "https://civitai.com/api/download/models/9409"
424
- Lora_destination_folder4 = Lora_destination_folder3
425
- Lora_filename4 = "chara-arona-v1.safetensors"
426
- Lora_target4 = f"{Lora_destination_folder4}/{Lora_filename4}"
427
-
428
- if Lora_download_task4:
429
- subprocess.run(["wget", Lora_url4, "-O", Lora_target4])
430
-
431
- # Lora任务5
432
- Lora_download_task5 = False
433
- Lora_url5 = ""
434
- Lora_destination_folder5 = Lora_destination_folder3
435
- Lora_filename5 = ""
436
- Lora_target5 = f"{Lora_destination_folder5}/{Lora_filename5}"
437
-
438
- if Lora_download_task5:
439
- subprocess.run(["wget", Lora_url5, "-O", Lora_target5])
440
-
441
- # Lora任务6
442
- Lora_download_task6 = False
443
- Lora_url6 = ""
444
- Lora_destination_folder6 = Lora_destination_folder3
445
- Lora_filename6 = ""
446
- Lora_target6 = f"{Lora_destination_folder6}/{Lora_filename6}"
447
-
448
- if Lora_download_task6:
449
- subprocess.run(["wget", Lora_url6, "-O", Lora_target6])
450
-
451
- # VAE下载
452
- # VAE任务1
453
- VAE_download_task1 = True
454
- VAE_url1 = "https://civitai.com/api/download/models/25986"
455
- VAE_destination_folder1 = "/content/ui/models/VAE"
456
- VAE_filename1 = "anypastelAnythingV45_anypastelAnythingV45.zip"
457
- VAE_target1 = f"{VAE_destination_folder1}/{VAE_filename1}"
458
-
459
- if VAE_download_task1:
460
- subprocess.run(["wget", VAE_url1, "-O", VAE_target1])
461
-
462
- # VAE任务2
463
- VAE_download_task2 = True
464
- VAE_url2 = "https://civitai.com/api/download/models/64133"
465
- VAE_destination_folder2 = "/content/ui/models/VAE"
466
- VAE_filename2 = "counterfeit.vae.pt"
467
- VAE_target2 = f"{VAE_destination_folder2}/{VAE_filename2}"
468
-
469
- if VAE_download_task2:
470
- subprocess.run(["wget", VAE_url2, "-O", VAE_target2])
471
-
472
- # VAE任务3
473
- VAE_download_task3 = True
474
- VAE_url3 = "https://civitai.com/api/download/models/80869?type=Model&format=Other"
475
- VAE_destination_folder3 = "/content/ui/models/VAE"
476
- VAE_filename3 = "vaeFtMse840000Ema_v100.safetensors"
477
- VAE_target3 = f"{VAE_destination_folder3}/{VAE_filename3}"
478
-
479
- if VAE_download_task3:
480
- subprocess.run(["wget", VAE_url3, "-O", VAE_target3])
481
-
482
- # VAE任务4
483
- VAE_download_task4 = False
484
- VAE_url4 = "https://huggingface.co/admruul/anything-v3.0/resolve/main/Anything-V3.0.vae.pt"
485
- VAE_destination_folder4 = "/content/ui/models/VAE"
486
- VAE_filename4 = "Anything-V3.0.vae.pt"
487
- VAE_target4 = f"{VAE_destination_folder4}/{VAE_filename4}"
488
-
489
- if VAE_download_task4:
490
- subprocess.run(["wget", VAE_url4, "-O", VAE_target4])
491
-
492
- # VAE任务5
493
- VAE_download_task5 = True
494
- VAE_url5 = "https://civitai.com/api/download/models/131654?type=Model&format=SafeTensor"
495
- VAE_destination_folder5 = "/content/ui/models/VAE"
496
- VAE_filename5 = "anythingKlF8Anime2VaeFtMse840000_klF8Anime2.safetensors"
497
- VAE_target5 = f"{VAE_destination_folder5}/{VAE_filename5}"
498
-
499
- if VAE_download_task5:
500
- subprocess.run(["wget", VAE_url5, "-O", VAE_target5])
501
-
502
- # VAE任务6
503
- VAE_download_task6 = True
504
- VAE_url6 = "https://civitai.com/api/download/models/88156?type=Model&format=Other"
505
- VAE_destination_folder6 = "/content/ui/models/VAE"
506
- VAE_filename6 = "ClearVAE.2.3.vae.pt"
507
- VAE_target6 = f"{VAE_destination_folder6}/{VAE_filename6}"
508
-
509
- if VAE_download_task6:
510
- subprocess.run(["wget", VAE_url6, "-O", VAE_target6])
511
-
512
- # VAE任务7
513
- VAE_download_task7 = True
514
- VAE_url7 = "https://civitai.com/api/download/models/121354?type=Model&format=Other"
515
- VAE_destination_folder7 = "/content/ui/models/VAE"
516
- VAE_filename7 = "orangemix_v1.pt"
517
- VAE_target7 = f"{VAE_destination_folder7}/{VAE_filename7}"
518
-
519
- if VAE_download_task7:
520
- subprocess.run(["wget", VAE_url7, "-O", VAE_target7])
521
-
522
- # VAE任务8
523
- VAE_download_task8 = True
524
- VAE_url8 = "https://civitai.com/api/download/models/28569?type=Model&format=Other"
525
- VAE_destination_folder8 = "/content/ui/models/VAE"
526
- VAE_filename8 = "klF8Anime2_klF8Anime2VAE.pt"
527
- VAE_target8 = f"{VAE_destination_folder8}/{VAE_filename8}"
528
-
529
- if VAE_download_task8:
530
- subprocess.run(["wget", VAE_url8, "-O", VAE_target8])
531
-
532
- # VAE任务9
533
- VAE_download_task9 = False
534
- VAE_url9 = ""
535
- VAE_destination_folder9 = "/content/ui/models/VAE"
536
- VAE_filename9 = ""
537
- VAE_target9 = f"{VAE_destination_folder9}/{VAE_filename9}"
538
-
539
- if VAE_download_task9:
540
- subprocess.run(["wget", VAE_url9, "-O", VAE_target9])
541
-
542
- # VAE任务10
543
- VAE_download_task10 = False
544
- VAE_url10 = ""
545
- VAE_destination_folder10 = "/content/ui/models/VAE"
546
- VAE_filename10 = ""
547
- VAE_target10 = f"{VAE_destination_folder10}/{VAE_filename10}"
548
-
549
- if VAE_download_task10:
550
- subprocess.run(["wget", VAE_url10, "-O", VAE_target10])
551
-
552
- # VAE任务11
553
- VAE_download_task11 = False
554
- VAE_url11 = ""
555
- VAE_destination_folder11 = "/content/ui/models/VAE"
556
- VAE_filename11 = ""
557
- VAE_target11 = f"{VAE_destination_folder11}/{VAE_filename11}"
558
-
559
- if VAE_download_task11:
560
- subprocess.run(["wget", VAE_url11, "-O", VAE_target11])
561
-
562
- # VAE任务12
563
- VAE_download_task12 = False
564
- VAE_url12 = ""
565
- VAE_destination_folder12 = "/content/ui/models/VAE"
566
- VAE_filename12 = ""
567
- VAE_target12 = f"{VAE_destination_folder12}/{VAE_filename12}"
568
-
569
- if VAE_download_task12:
570
- subprocess.run(["wget", VAE_url12, "-O", VAE_target12])
571
-
572
- # VAE任务13
573
- VAE_download_task13 = False
574
- VAE_url13 = ""
575
- VAE_destination_folder13 = "/content/ui/models/VAE"
576
- VAE_filename13 = ""
577
- VAE_target13 = f"{VAE_destination_folder13}/{VAE_filename13}"
578
-
579
- if VAE_download_task13:
580
- subprocess.run(["wget", VAE_url13, "-O", VAE_target13])
581
-
582
-
583
- # embeddings模型下载
584
- # 任务1
585
- # _下载任务1_
586
- embeddings_download_task1 = True #@param {type:"boolean"}
587
- embeddings_url1 = "https://civitai.com/api/download/models/125849"
588
- embeddings_destination_folder1 = "/content/ui/embeddings" #@ param {type:"string"}
589
- embeddings_filename1 = "bad-hands-5.pt"
590
- embeddings_target1 = f'{embeddings_destination_folder1}/{embeddings_filename1}'
591
-
592
- if embeddings_download_task1:
593
- subprocess.run(['wget', '-O', embeddings_target1, embeddings_url1])
594
-
595
- # 任务2
596
- # _下载任务2_
597
- embeddings_download_task2 = False #@param {type:"boolean"}
598
- embeddings_url2 = ""
599
- embeddings_destination_folder2 = "/content/ui/embeddings" #@ param {type:"string"}
600
- embeddings_filename2 = ""
601
- embeddings_target2 = f'{embeddings_destination_folder2}/{embeddings_filename2}'
602
-
603
- if embeddings_download_task2:
604
- subprocess.run(['wget', '-O', embeddings_target2, embeddings_url2])
605
-
606
- # 任务3
607
- # _下载任务3_
608
- embeddings_download_task3 = False #@param {type:"boolean"}
609
- embeddings_url3 = ""
610
- embeddings_destination_folder3 = "/content/ui/embeddings" #@ param {type:"string"}
611
- embeddings_filename3 = ""
612
- embeddings_target3 = f'{embeddings_destination_folder3}/{embeddings_filename3}'
613
-
614
- if embeddings_download_task3:
615
- subprocess.run(['wget', '-O', embeddings_target3, embeddings_url3])
616
-
617
- # 任务4
618
- # _下载任务4_
619
- embeddings_download_task4 = False #@param {type:"boolean"}
620
- embeddings_url4 = ""
621
- embeddings_destination_folder4 = "/content/ui/embeddings" #@ param {type:"string"}
622
- embeddings_filename4 = ""
623
- embeddings_target4 = f'{embeddings_destination_folder4}/{embeddings_filename4}'
624
-
625
- if embeddings_download_task4:
626
- subprocess.run(['wget', '-O', embeddings_target4, embeddings_url4])
627
-
628
- # 任务5
629
- # _下载任务5_
630
- embeddings_download_task5 = False #@param {type:"boolean"}
631
- embeddings_url5 = ""
632
- embeddings_destination_folder5 = "/content/ui/embeddings" #@ param {type:"string"}
633
- embeddings_filename5 = ""
634
- embeddings_target5 = f'{embeddings_destination_folder5}/{embeddings_filename5}'
635
-
636
- if embeddings_download_task5:
637
- subprocess.run(['wget', '-O', embeddings_target5, embeddings_url5])
638
-
639
-
640
-
641
-
642
-
643
- #开始运行
644
-
645
- # 初始化变量a、b、c和w的初始值
646
- a = ""
647
- b = ""
648
- c = ""
649
- d = ""
650
- w = ""
651
-
652
- # 构建变量a
653
- a = binascii.unhexlify("737461626c65").decode("ascii")
654
-
655
- # 构建变量b,使其等于a的首字母大写版本
656
- b = binascii.unhexlify("537461626c65").decode("ascii")
657
-
658
- # 构建变量c
659
- c = binascii.unhexlify("7364").decode("ascii")
660
-
661
- # 构建变量d
662
- d = binascii.unhexlify("646966667573696f6e").decode("ascii")
663
-
664
- # 构建变量w
665
- w = binascii.unhexlify("7765627569").decode("ascii")
666
-
667
- # %cd /content/ui/
668
-
669
- #python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queu --multiple --no-download-sd-model --share
670
- #python launch.py --listen --xformers --enable-insecure-extension-access --theme dark --gradio-queue --no-download-sd-model --share
671
-
672
-
673
-
674
- # 自定义下载
675
- ZDY_Download = False
676
- if ZDY_Download:
677
- url = "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors"
678
- # _下载链接._
679
- Download_destination_folder = ""
680
- # _在google云盘中找到想要下载的目标路径右键复制地址._
681
- filename = "vae-ft-mse-840000-ema-pruned.safetensors"
682
- # _保存的文件名._
683
-
684
- target = f'{destination}/{filename}'
685
-
686
- subprocess.run(['wget', '-O', target, url])
687
-
688
-
689
- # 下载生成图片到本地
690
- Picture_Download = False
691
- if Picture_Download:
692
- from google.colab import files
693
-
694
- subprocess.run(['zip', '-r', '/content/outputs.zip', '/content/{a}-d-w/outputs'])
695
- files.download('/content/outputs.zip')