ACCA225 commited on
Commit
b35d689
1 Parent(s): b676ace

Update app3.py

Browse files
Files changed (1) hide show
  1. app3.py +20 -6
app3.py CHANGED
@@ -21,6 +21,21 @@ from concurrent.futures import ProcessPoolExecutor
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/stab /home/xlab-app-center/stable-diffusion-webui")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  os.system(f"cp /home/xlab-app-center/styles.csv /home/xlab-app-center/stable-diffusion-webui/styles.csv")
26
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
@@ -53,9 +68,9 @@ create_directory(configs_directory)
53
  #download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(configs_directory, 'ui-config-pri.json'))
54
  #download_file('https://huggingface.co/spaces/ACCA225/Stable_Diffusion-No-2/resolve/main/ui-config-pub.json', os.path.join(configs_directory, 'ui-config.json'))
55
  # 下载配置文件
56
- download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/config-pub.json', os.path.join(base_directory, 'config.json'))
57
  download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(base_directory, 'ui-config-pri.json'))
58
- download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pub.json', os.path.join(base_directory, 'ui-config.json'))
59
 
60
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
61
  os.system(f"rm -rf ./batchlinks-webui")
@@ -210,9 +225,7 @@ def check_service(host, port):
210
  def localProxy():
211
  os.system('sudo apt install nginx -y')
212
  download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/proxy_nginx.conf', os.path.join(base_directory, 'proxy_nginx.conf'))
213
- if not check_service('localhost',_server_port):
214
- run(f'''nginx -c /home/xlab-app-center/stable-diffusion-webui/proxy_nginx.conf''')
215
- run(f'''nginx -s reload''')
216
 
217
  # WandB登录
218
  os.system('wandb login 5c00964de1bb95ec1ab24869d4c523c59e0fb8e3')
@@ -236,7 +249,8 @@ def monitor_gpu():
236
 
237
  time.sleep(60)
238
  def zrok():
239
-
 
240
  #os.system("wget https://huggingface.co/datasets/ACCA225/frp-1/resolve/main/frpc")
241
  #os.system("chmod +x ./frpc")
242
  #os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")
 
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/stab /home/xlab-app-center/stable-diffusion-webui")
24
+ def notbook():
25
+ os.system("pip install jupyterlab")
26
+ os.system("pip install pyngrok")
27
+ # 构建命令字符串
28
+ ngrok_command = f"ngrok http 8889 --authtoken=2cdw5pJsqgsq1igQKeHIpNwTNG7_7LQD3jojKKQ7PzcnNkok5"
29
+ ngrok_command2 = f"ngrok tunnel --label edge=edghts_2doueG9BDi9rCXUGnsSsNbTab8H --authtoken=2douOsr61tUyYwMVF3lfj9uZGoa_6FPJ2x1xhKPbL6z4euKkM --region=ap http://localhost:8889"
30
+ jupyter_command = "jupyter-lab --no-browser --ip=0.0.0.0 --allow-root --notebook-dir=/ --port=8889 --LabApp.token= --LabApp.allow_origin=* --LabApp.base_url="
31
+
32
+ # 启动 ngrok 进程
33
+ #ngrok_process = subprocess.Popen(ngrok_command, shell=True)
34
+ #time.sleep(30)
35
+ #ngrok_process2 = subprocess.Popen(ngrok_command2, shell=True)
36
+ # 启动 Jupyter 进程
37
+ jupyter_process = subprocess.Popen(jupyter_command, shell=True)
38
+ #os.system(f"ngrok tunnel --authtoken={ngrok_token} --region=ap http://localhost:8888 & python jupyter-lab --ServerApp.shutdown_no_activity_timeout=1800 --TerminalManager.cull_inactive_timeout=1800 --TerminalManager.cull_interval=300 --MappingKernelManager.cull_idle_timeout=1800 --MappingKernelManager.cull_interval=300 --MappingKernelManager.cull_connected=True --MappingKernelManager.cull_busy=True --no-browser --ip=0.0.0.0 --allow-root --notebook-dir=/ --port=8888 --LabApp.token= --LabApp.allow_origin=* --LabApp.base_url=")
39
 
40
  os.system(f"cp /home/xlab-app-center/styles.csv /home/xlab-app-center/stable-diffusion-webui/styles.csv")
41
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui")
 
68
  #download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(configs_directory, 'ui-config-pri.json'))
69
  #download_file('https://huggingface.co/spaces/ACCA225/Stable_Diffusion-No-2/resolve/main/ui-config-pub.json', os.path.join(configs_directory, 'ui-config.json'))
70
  # 下载配置文件
71
+ download_file('https://huggingface.co/spaces/ACCA225/Stable_Diffusion-No-2/resolve/main/config-pub.json', os.path.join(base_directory, 'config.json'))
72
  download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/ui-config-pri2.json', os.path.join(base_directory, 'ui-config-pri.json'))
73
+ download_file('https://huggingface.co/spaces/ACCA225/Stable_Diffusion-No-2/resolve/main/ui-config-pub.json', os.path.join(base_directory, 'ui-config.json'))
74
 
75
  os.chdir(f"/home/xlab-app-center/stable-diffusion-webui/extensions")
76
  os.system(f"rm -rf ./batchlinks-webui")
 
225
  def localProxy():
226
  os.system('sudo apt install nginx -y')
227
  download_file('https://huggingface.co/datasets/ACCA225/openxlab/resolve/main/proxy_nginx.conf', os.path.join(base_directory, 'proxy_nginx.conf'))
228
+ os.system("nginx -c /home/xlab-app-center/stable-diffusion-webui/proxy_nginx.conf")
 
 
229
 
230
  # WandB登录
231
  os.system('wandb login 5c00964de1bb95ec1ab24869d4c523c59e0fb8e3')
 
249
 
250
  time.sleep(60)
251
  def zrok():
252
+ localProxy()
253
+ notbook()
254
  #os.system("wget https://huggingface.co/datasets/ACCA225/frp-1/resolve/main/frpc")
255
  #os.system("chmod +x ./frpc")
256
  #os.system("./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738352 & ./frpc -f bsnehoeds17ett71i2cr79ujoa7ndkxz:13738353")