Update app2.py
Browse files
app2.py
CHANGED
@@ -88,7 +88,47 @@ def run(command, cwd=None, desc=None, errdesc=None, custom_env=None,try_error:bo
|
|
88 |
if show_shell_info:
|
89 |
print((result.stdout or ""))
|
90 |
return (result.stdout or "")
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
def mkdirs(path, exist_ok=True):
|
93 |
if path and not Path(path).exists():
|
94 |
os.makedirs(path,exist_ok=exist_ok)
|
@@ -106,8 +146,6 @@ plugins = [
|
|
106 |
#'https://openi.pcl.ac.cn/2575044704/sd-webui-supermerger',
|
107 |
'https://openi.pcl.ac.cn/2575044704/sd-webui-lora-block-weight',
|
108 |
'https://openi.pcl.ac.cn/2575044704/sd-skin-extension',
|
109 |
-
|
110 |
-
|
111 |
]
|
112 |
|
113 |
for plugin in plugins:
|
@@ -197,11 +235,11 @@ def monitor_gpu():
|
|
197 |
time.sleep(60)
|
198 |
def zrok():
|
199 |
#内网穿透
|
200 |
-
os.system('
|
201 |
os.system(f'chmod +x ./zrok')
|
202 |
os.system(f'./zrok enable sbdZuzXMfujU')
|
203 |
-
os.system(f'./zrok share public localhost:7861')
|
204 |
os.system(f'./zrok share public localhost:7862')
|
|
|
205 |
def start():
|
206 |
#try:
|
207 |
# print('启动proxy')
|
@@ -218,8 +256,8 @@ def start():
|
|
218 |
|
219 |
|
220 |
process = subprocess.Popen(command, shell=True)
|
221 |
-
time.sleep(
|
222 |
-
os.system(f"{command} --port=
|
223 |
except Exception as e:
|
224 |
# 在这里处理异常的代码
|
225 |
print(f"启动SD发生错误: {e}")
|
@@ -229,12 +267,10 @@ def start():
|
|
229 |
except Exception as e:
|
230 |
# 在这里处理异常的代码
|
231 |
print(f"An error occurred: {e}")
|
232 |
-
|
233 |
-
wandb_thread = threading.Thread(target=monitor_gpu)
|
234 |
|
235 |
net_thread = threading.Thread(target=zrok)
|
236 |
-
|
237 |
-
wandb_thread.start()
|
238 |
net_thread.start()
|
239 |
-
|
240 |
-
|
|
|
88 |
if show_shell_info:
|
89 |
print((result.stdout or ""))
|
90 |
return (result.stdout or "")
|
91 |
+
import subprocess
|
92 |
+
def sdmodel():
|
93 |
+
def download_with_aria2(urls):
|
94 |
+
# 使用循环遍历所有的下载链接
|
95 |
+
for url in urls:
|
96 |
+
# 将huggingface.co替换为hf-mirror.com
|
97 |
+
url = url.replace('huggingface.co', 'hf-mirror.com')
|
98 |
+
file_name = url.split('/')[-1].split('?')[0]
|
99 |
+
# 构建aria2c命令
|
100 |
+
command = f'aria2c -x 16 -s 16 -c -k 1M -o "{file_name}" "{url}" -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion'
|
101 |
+
|
102 |
+
try:
|
103 |
+
# 使用subprocess模块运行aria2c命令
|
104 |
+
subprocess.run(command, shell=True, check=True)
|
105 |
+
except subprocess.CalledProcessError as e:
|
106 |
+
# 打印错误信息(如果有)
|
107 |
+
print(f'Error downloading {url}: {e}')
|
108 |
+
|
109 |
+
# 直接将链接作为多行字符串传递给函数
|
110 |
+
download_urls = """
|
111 |
+
https://huggingface.co/HiroHiroHirook/meinamix_meinaV8/resolve/main/meinamix_meinaV8.safetensors?download=true
|
112 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/anything_v50.safetensors?download=true
|
113 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/blindbox_v1_mix.safetensors?download=true
|
114 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/cuteyukimixAdorable_naiV3style.safetensors?download=true
|
115 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/ddicon_v10.ckpt?download=true
|
116 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/meinamix_meinaV11.safetensors?download=true
|
117 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/meinapastel_v6-inpainting.safetensors?download=true
|
118 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/meinapastel_v6Pastel.safetensors?download=true
|
119 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/midjourney_20230624181825.safetensors?download=true
|
120 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/mixProV4_v4.safetensors?download=true
|
121 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/qteamixQ_omegaFp16.safetensors?download=true
|
122 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/uberRealisticPornMerge_urpmv13.safetensors?download=true
|
123 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/velaMix_velaMixVersion2.safetensors?download=true
|
124 |
+
"""
|
125 |
+
|
126 |
+
# 使用字符串的splitlines方法将字符串分割成列表
|
127 |
+
urls_list = download_urls.strip().splitlines()
|
128 |
+
|
129 |
+
# 调用函数开始下载
|
130 |
+
download_with_aria2(urls_list)
|
131 |
+
sdmodel()
|
132 |
def mkdirs(path, exist_ok=True):
|
133 |
if path and not Path(path).exists():
|
134 |
os.makedirs(path,exist_ok=exist_ok)
|
|
|
146 |
#'https://openi.pcl.ac.cn/2575044704/sd-webui-supermerger',
|
147 |
'https://openi.pcl.ac.cn/2575044704/sd-webui-lora-block-weight',
|
148 |
'https://openi.pcl.ac.cn/2575044704/sd-skin-extension',
|
|
|
|
|
149 |
]
|
150 |
|
151 |
for plugin in plugins:
|
|
|
235 |
time.sleep(60)
|
236 |
def zrok():
|
237 |
#内网穿透
|
238 |
+
os.system(f'wget https://hf-mirror.com/datasets/ACCA225/zrok/resolve/main/zrok')
|
239 |
os.system(f'chmod +x ./zrok')
|
240 |
os.system(f'./zrok enable sbdZuzXMfujU')
|
|
|
241 |
os.system(f'./zrok share public localhost:7862')
|
242 |
+
os.system(f'./zrok share public localhost:7863')
|
243 |
def start():
|
244 |
#try:
|
245 |
# print('启动proxy')
|
|
|
256 |
|
257 |
|
258 |
process = subprocess.Popen(command, shell=True)
|
259 |
+
time.sleep(250)
|
260 |
+
os.system(f"{command} --port=7862 & {command} --port=7863")
|
261 |
except Exception as e:
|
262 |
# 在这里处理异常的代码
|
263 |
print(f"启动SD发生错误: {e}")
|
|
|
267 |
except Exception as e:
|
268 |
# 在这里处理异常的代码
|
269 |
print(f"An error occurred: {e}")
|
270 |
+
|
|
|
271 |
|
272 |
net_thread = threading.Thread(target=zrok)
|
273 |
+
|
|
|
274 |
net_thread.start()
|
275 |
+
|
276 |
+
monitor_gpu()
|