ACCA225 commited on
Commit
d3ce4ab
1 Parent(s): b25adee

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +35 -8
app2.py CHANGED
@@ -17,6 +17,11 @@ 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")
@@ -27,6 +32,9 @@ 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")
@@ -164,6 +172,8 @@ plugins = [
164
  "https://kkgithub.com/LonicaMewinsky/gif2gif.git",
165
  "https://kkgithub.com/modelscope/facechain.git",
166
  ]
 
 
167
  needed_extensions = [
168
  "https://openi.pcl.ac.cn/2575044704/sd-extension-system-info",
169
  "https://openi.pcl.ac.cn/2575044704/batchlinks-webui",
@@ -178,6 +188,7 @@ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mir
178
  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")
179
  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")
180
  os.system(f"rm /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion/*porn*.safetensors")
 
181
  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")
182
  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")
183
  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")
@@ -186,6 +197,8 @@ os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://hf-mir
186
  # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/cyber-realistic/weight//cyberrealistic_v32.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o cyberrealistic_v32.safetensors")
187
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
188
  print('webui launching...')
 
 
189
  package_envs = [
190
  {"env": "STABLE_DIFFUSION_REPO", "url": os.environ.get('STABLE_DIFFUSION_REPO', "https://gitcode.net/overbill1683/stablediffusion")},
191
  {"env": "STABLE_DIFFUSION_XL_REPO", "url": os.environ.get('STABLE_DIFFUSION_XL_REPO', "https://gitcode.net/overbill1683/generative-models")},
@@ -258,12 +271,18 @@ def monitor_gpu():
258
  time.sleep(60)
259
  def zrok():
260
 
261
- os.system("wget https://hf-mirror.com/datasets/ACCA225/frp-1/resolve/main/frpc")
262
- os.system("chmod +x ./frpc")
263
- os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")
264
  pass
 
 
 
 
 
265
  def start():
266
- #os.system("pip install pyngrok")
 
267
  #try:
268
  # print('启动proxy')
269
  # threading.Thread(target = localProxy,daemon=True).start()
@@ -275,15 +294,23 @@ def start():
275
  os.system(f"python launch.py --api --xformers --exit --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
276
  #time.sleep(5)
277
 
278
- command = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle"
279
- command1 = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7862 --ngrok=2bgXLjjKFvxfbuZFlR2NMZkvL8n_4WrK7f15FLtWb8p7v3oaF"
280
- command2 = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7863 --ngrok=2CXyNlT9xGfFoL5ruI6hQV20FNq_7tbmuzS9RtyNTkyEe1J6C"
281
  process = subprocess.Popen(command, shell=True)
282
  time.sleep(250)
283
  process = subprocess.Popen(command1, shell=True)
284
  time.sleep(100)
285
  print("启动ngrok中")
286
- os.system(f"{command2}")
 
 
 
 
 
 
 
 
287
  except Exception as e:
288
  # 在这里处理异常的代码
289
  print(f"启动SD发生错误: {e}")
 
17
  import socket
18
  from concurrent.futures import ProcessPoolExecutor
19
  # import wandb
20
+ import base64
21
+
22
+ ngrok_token = "2bgXLjjKFvxfbuZFlR2NMZkvL8n_4WrK7f15FLtWb8p7v3oaF"
23
+ _ngrok_token = "2CXyNlT9xGfFoL5ruI6hQV20FNq_7tbmuzS9RtyNTkyEe1J6C"
24
+
25
  os.system("pip install nvidia-ml-py3")
26
  os.chdir(f"/home/xlab-app-center")
27
  os.system(f"git clone https://openi.pcl.ac.cn/2575044704/stab /home/xlab-app-center/stable-diffusion-webui")
 
32
  os.system(f"git reset --hard")
33
  import os
34
 
35
+ ngrok_token = "2bgXLjjKFvxfbuZFlR2NMZkvL8n_4WrK7f15FLtWb8p7v3oaF" #7862端口
36
+ _ngrok_token = "2CXyNlT9xGfFoL5ruI6hQV20FNq_7tbmuzS9RtyNTkyEe1J6C" #7863端口
37
+
38
  def remove_restart():
39
  os.chdir("/home/xlab-app-center/stable-diffusion-webui/html")
40
  os.system("rm ./footer.html && wget -O footer.html https://hf-mirror.com/datasets/ACCA225/openxlab/resolve/main/footer.html")
 
172
  "https://kkgithub.com/LonicaMewinsky/gif2gif.git",
173
  "https://kkgithub.com/modelscope/facechain.git",
174
  ]
175
+ suffix_1 = "Nyan9"
176
+ suffix_2 = "BiliBili"
177
  needed_extensions = [
178
  "https://openi.pcl.ac.cn/2575044704/sd-extension-system-info",
179
  "https://openi.pcl.ac.cn/2575044704/batchlinks-webui",
 
188
  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")
189
  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")
190
  os.system(f"rm /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion/*porn*.safetensors")
191
+
192
  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")
193
  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")
194
  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")
 
197
  # os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://download.openxlab.org.cn/models/camenduru/cyber-realistic/weight//cyberrealistic_v32.safetensors -d /home/xlab-app-center/stable-diffusion-webui/models/Stable-diffusion -o cyberrealistic_v32.safetensors")
198
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
199
  print('webui launching...')
200
+ pwd_1 = ngrok_token + suffix_1
201
+ pwd_2 = _ngrok_token + suffix_2
202
  package_envs = [
203
  {"env": "STABLE_DIFFUSION_REPO", "url": os.environ.get('STABLE_DIFFUSION_REPO', "https://gitcode.net/overbill1683/stablediffusion")},
204
  {"env": "STABLE_DIFFUSION_XL_REPO", "url": os.environ.get('STABLE_DIFFUSION_XL_REPO', "https://gitcode.net/overbill1683/generative-models")},
 
271
  time.sleep(60)
272
  def zrok():
273
 
274
+ #os.system("wget https://hf-mirror.com/datasets/ACCA225/frp-1/resolve/main/frpc")
275
+ #os.system("chmod +x ./frpc")
276
+ #os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")
277
  pass
278
+
279
+ _pwd_1 = base64.b64encode(pwd_1.encode()).decode()
280
+ _pwd_2 = base64.b64encode(pwd_2.encode()).decode()
281
+
282
+ apitoken = "{}:{}".format(_pwd_1, _pwd_2)
283
  def start():
284
+ os.system("pip install pyngrok")
285
+
286
  #try:
287
  # print('启动proxy')
288
  # threading.Thread(target = localProxy,daemon=True).start()
 
294
  os.system(f"python launch.py --api --xformers --exit --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle")
295
  #time.sleep(5)
296
 
297
+ command = f"python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --api-auth={apitoken}"
298
+ command1 = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7862"
299
+ command2 = "python launch.py --api --xformers --enable-insecure-extension-access --gradio-queue --disable-safe-unpickle --port=7863"
300
  process = subprocess.Popen(command, shell=True)
301
  time.sleep(250)
302
  process = subprocess.Popen(command1, shell=True)
303
  time.sleep(100)
304
  print("启动ngrok中")
305
+ command_ngrok = f"ngrok http 7862 --authtoken={ngrok_token} --region=ap & ngrok http 7863 --authtoken={_ngrok_token} --region=ap"
306
+ process = subprocess.Popen(command2, shell=True)
307
+ def start_ngrok():
308
+ try:
309
+ os.system(f"{command_ngrok}")
310
+ except Exception as e:
311
+ print(f"ngrok启动失败: {e}")
312
+ start_ngrok()
313
+ start_ngrok()
314
  except Exception as e:
315
  # 在这里处理异常的代码
316
  print(f"启动SD发生错误: {e}")