Update app3.py
Browse files
app3.py
CHANGED
@@ -16,17 +16,23 @@ import threading
|
|
16 |
import time
|
17 |
import socket
|
18 |
from concurrent.futures import ProcessPoolExecutor
|
19 |
-
os.system("pip install fastapi==0.90.1")
|
20 |
# import wandb
|
21 |
os.system("pip install nvidia-ml-py3")
|
22 |
os.chdir(f"/home/xlab-app-center")
|
23 |
-
os.system(f"git clone https://openi.pcl.ac.cn/2575044704/
|
|
|
24 |
os.system(f"cp /home/xlab-app-center/styles.csv /home/xlab-app-center/stable-diffusion-webui/styles.csv")
|
25 |
os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
|
26 |
os.system(f"git lfs install")
|
27 |
os.system(f"git reset --hard")
|
28 |
import os
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
def create_directory(directory_path):
|
31 |
if not os.path.exists(directory_path):
|
32 |
os.makedirs(directory_path)
|
@@ -35,7 +41,7 @@ def download_file(url, destination_path):
|
|
35 |
os.system(f'wget -O {destination_path} {url}')
|
36 |
|
37 |
# 设置基本路径
|
38 |
-
base_directory = '/home/xlab-app-center'
|
39 |
configs_directory = os.path.join(base_directory, 'configs')
|
40 |
|
41 |
# 创建configs文件夹
|
@@ -43,14 +49,16 @@ create_directory(configs_directory)
|
|
43 |
|
44 |
# 下载配置文件
|
45 |
#download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(configs_directory, 'config.json'))
|
46 |
-
#download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-
|
47 |
#download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(configs_directory, 'ui-config.json'))
|
48 |
# 下载配置文件
|
49 |
download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(base_directory, 'config.json'))
|
50 |
-
download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-
|
51 |
download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(base_directory, 'ui-config.json'))
|
52 |
|
53 |
os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
|
|
|
|
|
54 |
show_shell_info = False
|
55 |
def run(command, cwd=None, desc=None, errdesc=None, custom_env=None,try_error:bool=True) -> str:
|
56 |
global show_shell_info
|
@@ -89,7 +97,47 @@ def run(command, cwd=None, desc=None, errdesc=None, custom_env=None,try_error:bo
|
|
89 |
if show_shell_info:
|
90 |
print((result.stdout or ""))
|
91 |
return (result.stdout or "")
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
def mkdirs(path, exist_ok=True):
|
94 |
if path and not Path(path).exists():
|
95 |
os.makedirs(path,exist_ok=exist_ok)
|
@@ -97,19 +145,25 @@ plugins = [
|
|
97 |
"https://gitcode.net/overbill1683/stable-diffusion-webui-localization-zh_Hans",
|
98 |
"https://gitcode.net/ranting8323/multidiffusion-upscaler-for-automatic1111",
|
99 |
"https://gitcode.net/ranting8323/adetailer",
|
100 |
-
"https://gitcode.net/ranting8323/sd-webui-prompt-all-in-one",
|
101 |
"https://gitcode.net/ranting8323/sd-webui-inpaint-anything",
|
102 |
"https://gitcode.net/ranting8323/a1111-sd-webui-tagcomplete",
|
103 |
"https://gitcode.net/nightaway/sd-webui-infinite-image-browsing",
|
104 |
"https://openi.pcl.ac.cn/2575044704/sd-extension-system-info",
|
105 |
"https://openi.pcl.ac.cn/2575044704/batchlinks-webui",
|
106 |
'https://openi.pcl.ac.cn/2575044704/stable-diffusion-webui-localization-zh_CN',
|
107 |
-
#'https://openi.pcl.ac.cn/2575044704/sd-webui-supermerger',
|
108 |
'https://openi.pcl.ac.cn/2575044704/sd-webui-lora-block-weight',
|
109 |
'https://openi.pcl.ac.cn/2575044704/sd-skin-extension',
|
110 |
-
"https://
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
]
|
114 |
|
115 |
for plugin in plugins:
|
@@ -119,6 +173,7 @@ os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/models/adetailer")
|
|
119 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8s.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8s.pt")
|
120 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8n.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8n.pt")
|
121 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/kaggle/input/museum/131-half.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o [萌二次元]131-half.safetensors")
|
|
|
122 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/ba.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o ba.safetensors")
|
123 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/racaco2.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o racaco2.safetensors")
|
124 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/coinz/Add-detail/resolve/main/add_detail.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o add_detail.safetensors")
|
@@ -141,7 +196,7 @@ for i in package_envs:
|
|
141 |
import os
|
142 |
import time
|
143 |
import wandb
|
144 |
-
|
145 |
import os
|
146 |
import time
|
147 |
import wandb
|
@@ -161,52 +216,83 @@ def check_service(host, port):
|
|
161 |
except socket.error:
|
162 |
return False
|
163 |
def localProxy():
|
164 |
-
os.system('apt install nginx -y')
|
165 |
download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/proxy_nginx.conf', os.path.join(base_directory, 'proxy_nginx.conf'))
|
166 |
-
|
|
|
|
|
167 |
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
import os
|
170 |
import threading
|
171 |
import wandb
|
172 |
import time
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
-
#
|
177 |
-
|
|
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
186 |
os.system("wget https://hf-mirror.com/datasets/ACCA225/frp-1/resolve/main/frpc")
|
187 |
os.system("chmod +x ./frpc")
|
188 |
-
os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
try:
|
190 |
#安装环境
|
191 |
-
|
192 |
#time.sleep(5)
|
193 |
|
194 |
-
command = "python launch.py --api --
|
195 |
-
|
196 |
-
|
197 |
process = subprocess.Popen(command, shell=True)
|
198 |
-
time.sleep(
|
199 |
-
#
|
|
|
|
|
|
|
200 |
except Exception as e:
|
201 |
# 在这里处理异常的代码
|
202 |
print(f"启动SD发生错误: {e}")
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
-
start_thread = threading.Thread(target=start)
|
206 |
|
207 |
-
|
208 |
|
209 |
-
|
210 |
|
211 |
-
|
212 |
-
time.sleep(90000)
|
|
|
16 |
import time
|
17 |
import socket
|
18 |
from concurrent.futures import ProcessPoolExecutor
|
|
|
19 |
# import wandb
|
20 |
os.system("pip install nvidia-ml-py3")
|
21 |
os.chdir(f"/home/xlab-app-center")
|
22 |
+
os.system(f"git clone https://openi.pcl.ac.cn/2575044704/stab /home/xlab-app-center/stable-diffusion-webui")
|
23 |
+
|
24 |
os.system(f"cp /home/xlab-app-center/styles.csv /home/xlab-app-center/stable-diffusion-webui/styles.csv")
|
25 |
os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
|
26 |
os.system(f"git lfs install")
|
27 |
os.system(f"git reset --hard")
|
28 |
import os
|
29 |
|
30 |
+
def remove_restart():
|
31 |
+
os.chdir("/home/xlab-app-center/stable-diffusion-webui/html")
|
32 |
+
os.system("rm ./footer.html && wget -O footer.html https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/footer.html")
|
33 |
+
os.chdir("/home/xlab-app-center/stable-diffusion-webui/modules")
|
34 |
+
os.system("rm ./ui_settings.py && wget -O ui_settings.py https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui_settings.py ")
|
35 |
+
remove_restart()
|
36 |
def create_directory(directory_path):
|
37 |
if not os.path.exists(directory_path):
|
38 |
os.makedirs(directory_path)
|
|
|
41 |
os.system(f'wget -O {destination_path} {url}')
|
42 |
|
43 |
# 设置基本路径
|
44 |
+
base_directory = '/home/xlab-app-center/stable-diffusion-webui'
|
45 |
configs_directory = os.path.join(base_directory, 'configs')
|
46 |
|
47 |
# 创建configs文件夹
|
|
|
49 |
|
50 |
# 下载配置文件
|
51 |
#download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(configs_directory, 'config.json'))
|
52 |
+
#download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(configs_directory, 'ui-config-pri.json'))
|
53 |
#download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(configs_directory, 'ui-config.json'))
|
54 |
# 下载配置文件
|
55 |
download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(base_directory, 'config.json'))
|
56 |
+
download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(base_directory, 'ui-config-pri.json'))
|
57 |
download_file('https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(base_directory, 'ui-config.json'))
|
58 |
|
59 |
os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
|
60 |
+
os.system(f"rm -rf ./batchlinks-webui")
|
61 |
+
os.system(f"rm -rf ./sd-extension-system-info")
|
62 |
show_shell_info = False
|
63 |
def run(command, cwd=None, desc=None, errdesc=None, custom_env=None,try_error:bool=True) -> str:
|
64 |
global show_shell_info
|
|
|
97 |
if show_shell_info:
|
98 |
print((result.stdout or ""))
|
99 |
return (result.stdout or "")
|
100 |
+
import subprocess
|
101 |
+
def sdmodel():
|
102 |
+
def download_with_aria2(urls):
|
103 |
+
# 使用循环遍历所有的下载链接
|
104 |
+
for url in urls:
|
105 |
+
# 将huggingface.co替换为hf-mirror.com
|
106 |
+
url = url.replace('huggingface.co', 'hf-mirror.com')
|
107 |
+
file_name = url.split('/')[-1].split('?')[0]
|
108 |
+
# 构建aria2c命令
|
109 |
+
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'
|
110 |
+
|
111 |
+
try:
|
112 |
+
# 使用subprocess模块运行aria2c命令
|
113 |
+
subprocess.run(command, shell=True, check=True)
|
114 |
+
except subprocess.CalledProcessError as e:
|
115 |
+
# 打印错误信息(如果有)
|
116 |
+
print(f'Error downloading {url}: {e}')
|
117 |
+
|
118 |
+
# 直接将链接作为多行字符串传递给函数
|
119 |
+
download_urls = """
|
120 |
+
https://huggingface.co/HiroHiroHirook/meinamix_meinaV8/resolve/main/meinamix_meinaV8.safetensors?download=true
|
121 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/anything_v50.safetensors?download=true
|
122 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/blindbox_v1_mix.safetensors?download=true
|
123 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/cuteyukimixAdorable_naiV3style.safetensors?download=true
|
124 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/ddicon_v10.ckpt?download=true
|
125 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/meinamix_meinaV11.safetensors?download=true
|
126 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/meinapastel_v6-inpainting.safetensors?download=true
|
127 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/meinapastel_v6Pastel.safetensors?download=true
|
128 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/midjourney_20230624181825.safetensors?download=true
|
129 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/mixProV4_v4.safetensors?download=true
|
130 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/qteamixQ_omegaFp16.safetensors?download=true
|
131 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/uberRealisticPornMerge_urpmv13.safetensors?download=true
|
132 |
+
https://huggingface.co/datasets/ACCA225/kagglemodel/resolve/main/kaggle/temp/velaMix_velaMixVersion2.safetensors?download=true
|
133 |
+
"""
|
134 |
+
|
135 |
+
# 使用字符串的splitlines方法将字符串分割成列表
|
136 |
+
urls_list = download_urls.strip().splitlines()
|
137 |
+
|
138 |
+
# 调用函数开始下载
|
139 |
+
download_with_aria2(urls_list)
|
140 |
+
#sdmodel()
|
141 |
def mkdirs(path, exist_ok=True):
|
142 |
if path and not Path(path).exists():
|
143 |
os.makedirs(path,exist_ok=exist_ok)
|
|
|
145 |
"https://gitcode.net/overbill1683/stable-diffusion-webui-localization-zh_Hans",
|
146 |
"https://gitcode.net/ranting8323/multidiffusion-upscaler-for-automatic1111",
|
147 |
"https://gitcode.net/ranting8323/adetailer",
|
|
|
148 |
"https://gitcode.net/ranting8323/sd-webui-inpaint-anything",
|
149 |
"https://gitcode.net/ranting8323/a1111-sd-webui-tagcomplete",
|
150 |
"https://gitcode.net/nightaway/sd-webui-infinite-image-browsing",
|
151 |
"https://openi.pcl.ac.cn/2575044704/sd-extension-system-info",
|
152 |
"https://openi.pcl.ac.cn/2575044704/batchlinks-webui",
|
153 |
'https://openi.pcl.ac.cn/2575044704/stable-diffusion-webui-localization-zh_CN',
|
|
|
154 |
'https://openi.pcl.ac.cn/2575044704/sd-webui-lora-block-weight',
|
155 |
'https://openi.pcl.ac.cn/2575044704/sd-skin-extension',
|
156 |
+
"https://kkgithub.com/thygate/stable-diffusion-webui-depthmap-script.git",
|
157 |
+
"https://gitcode.net/ranting8323/sd-webui-prompt-all-in-one",
|
158 |
+
"https://gitcode.net/ranting8323/sd-webui-controlnet",
|
159 |
+
"https://kkgithub.com/SignalFlagZ/sd-webui-civbrowser.git",
|
160 |
+
"https://kkgithub.com/continue-revolution/sd-webui-animatediff.git",
|
161 |
+
"https://kkkkgithub.com/aigc-apps/sd-webui-EasyPhoto.git",
|
162 |
+
"https://kkgithub.com/Iyashinouta/sd-model-downloader.git",
|
163 |
+
"https://kkgithub.com/fkunn1326/openpose-editor.git",
|
164 |
+
"https://kkgithub.com/zero01101/openOutpaint-webUI-extension.git",
|
165 |
+
"https://kkgithub.com/LonicaMewinsky/gif2gif.git",
|
166 |
+
"https://kkgithub.com/modelscope/facechain.git",
|
167 |
]
|
168 |
|
169 |
for plugin in plugins:
|
|
|
173 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8s.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8s.pt")
|
174 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/Bingsu/adetailer/resolve/main/hand_yolov8n.pt -d /home/xlab-app-center/stable-diffusion-webui/models/adetailer -o hand_yolov8n.pt")
|
175 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/kaggle/input/museum/131-half.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o [萌二次元]131-half.safetensors")
|
176 |
+
os.system(f"rm /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion/*porn*.safetensors")
|
177 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/ba.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o ba.safetensors")
|
178 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/datasets/ACCC1380/private-model/resolve/main/racaco2.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o racaco2.safetensors")
|
179 |
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mirror.com/coinz/Add-detail/resolve/main/add_detail.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Lora -o add_detail.safetensors")
|
|
|
196 |
import os
|
197 |
import time
|
198 |
import wandb
|
199 |
+
import nvidia_smi
|
200 |
import os
|
201 |
import time
|
202 |
import wandb
|
|
|
216 |
except socket.error:
|
217 |
return False
|
218 |
def localProxy():
|
219 |
+
os.system('sudo apt install nginx -y')
|
220 |
download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/proxy_nginx.conf', os.path.join(base_directory, 'proxy_nginx.conf'))
|
221 |
+
if not check_service('localhost',_server_port):
|
222 |
+
run(f'''nginx -c /home/xlab-app-center/stable-diffusion-webui/proxy_nginx.conf''')
|
223 |
+
run(f'''nginx -s reload''')
|
224 |
|
225 |
+
# WandB登录
|
226 |
+
os.system('wandb login 5c00964de1bb95ec1ab24869d4c523c59e0fb8e3')
|
227 |
+
nvidia_smi.nvmlInit()
|
228 |
+
# 初始化WandB项目
|
229 |
+
wandb.init(project="gpu-temperature-monitor")
|
230 |
|
231 |
import os
|
232 |
import threading
|
233 |
import wandb
|
234 |
import time
|
235 |
+
def monitor_gpu():
|
236 |
+
start_thread = threading.Thread(target=start)
|
237 |
+
start_thread.start()
|
238 |
+
while True:
|
239 |
+
try:
|
240 |
+
# 获取 GPU 温度
|
241 |
+
handle = nvidia_smi.nvmlDeviceGetHandleByIndex(0) # 0 表示第一个 GPU
|
242 |
+
gpu_temperature = nvidia_smi.nvmlDeviceGetTemperature(handle, nvidia_smi.NVML_TEMPERATURE_GPU)
|
243 |
|
244 |
+
# 获取 GPU 使用率
|
245 |
+
utilization = nvidia_smi.nvmlDeviceGetUtilizationRates(handle)
|
246 |
+
gpu_usage = utilization.gpu
|
247 |
|
248 |
+
# 使用 WandB 记录 GPU 温度和使用率
|
249 |
+
wandb.log({"GPU 温度": gpu_temperature, "GPU 使用率": gpu_usage})
|
250 |
+
|
251 |
+
except Exception as e:
|
252 |
+
print(f"Error: {e}")
|
253 |
+
|
254 |
+
time.sleep(60)
|
255 |
+
def zrok():
|
256 |
+
|
257 |
os.system("wget https://hf-mirror.com/datasets/ACCA225/frp-1/resolve/main/frpc")
|
258 |
os.system("chmod +x ./frpc")
|
259 |
+
os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")
|
260 |
+
pass
|
261 |
+
def start():
|
262 |
+
#os.system("pip install pyngrok")
|
263 |
+
#try:
|
264 |
+
# print('启动proxy')
|
265 |
+
# threading.Thread(target = localProxy,daemon=True).start()
|
266 |
+
#except Exception as e:
|
267 |
+
# # 在这里处理异常的代码
|
268 |
+
# print(f"proxy An error occurred: {e}")
|
269 |
try:
|
270 |
#安装环境
|
271 |
+
os.system(f"python launch.py --api --xformers --exit --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
|
272 |
#time.sleep(5)
|
273 |
|
274 |
+
command = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle"
|
275 |
+
command1 = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7862 --ngrok=2bgXLjjKFvxfbuZFlR2NMZkvL8n_4WrK7f15FLtWb8p7v3oaF"
|
276 |
+
command2 = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7863 --ngrok=2CXyNlT9xGfFoL5ruI6hQV20FNq_7tbmuzS9RtyNTkyEe1J6C"
|
277 |
process = subprocess.Popen(command, shell=True)
|
278 |
+
time.sleep(250)
|
279 |
+
#process = subprocess.Popen(command1, shell=True)
|
280 |
+
time.sleep(100)
|
281 |
+
#print("启动ngrok中")
|
282 |
+
#os.system(f"{command2}")
|
283 |
except Exception as e:
|
284 |
# 在这里处理异常的代码
|
285 |
print(f"启动SD发生错误: {e}")
|
286 |
+
try:
|
287 |
+
#os.system(f"python launch.py --api --xformers --exit --enable-insecure-extension-access --ui-settings-file /home/xlab-app-center/config.json --ui-config-file /home/xlab-app-center/ui-config.json --gradio-queue --disable-safe-unpickle")
|
288 |
+
os.system(f"python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
|
289 |
+
except Exception as e:
|
290 |
+
# 在这里处理异常的代码
|
291 |
+
print(f"An error occurred: {e}")
|
292 |
|
|
|
293 |
|
294 |
+
net_thread = threading.Thread(target=zrok)
|
295 |
|
296 |
+
net_thread.start()
|
297 |
|
298 |
+
monitor_gpu()
|
|