ACCA225 commited on
Commit
3e3e7ea
1 Parent(s): be5b0e3

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +13 -1
app2.py CHANGED
@@ -18,9 +18,21 @@ import socket
18
  from concurrent.futures import ProcessPoolExecutor
19
  # import wandb
20
  import base64
 
 
 
21
  def notbook():
22
  os.system("pip install jupyterlab")
23
- 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=")
 
 
 
 
 
 
 
 
 
24
  notbook()
25
  ngrok_token = "2bgXLjjKFvxfbuZFlR2NMZkvL8n_4WrK7f15FLtWb8p7v3oaF"
26
  _ngrok_token = "2CXyNlT9xGfFoL5ruI6hQV20FNq_7tbmuzS9RtyNTkyEe1J6C"
 
18
  from concurrent.futures import ProcessPoolExecutor
19
  # import wandb
20
  import base64
21
+ import subprocess
22
+
23
+
24
  def notbook():
25
  os.system("pip install jupyterlab")
26
+ # 构建命令字符串
27
+ ngrok_command = f"ngrok tunnel --authtoken=2cdw5pJsqgsq1igQKeHIpNwTNG7_7LQD3jojKKQ7PzcnNkok5 --region=ap http://localhost:8889"
28
+ jupyter_command = "python jupyter-lab --TerminalManager.cull_interval=300 --MappingKernelManager.cull_interval=300 --MappingKernelManager.cull_connected=True --MappingKernelManager.cull_busy=True --no-browser --ip=0.0.0.0 --allow-root --notebook-dir=/ --port=8889 --LabApp.token= --LabApp.allow_origin=* --LabApp.base_url="
29
+
30
+ # 启动 ngrok 进程
31
+ ngrok_process = subprocess.Popen(ngrok_command, shell=True)
32
+
33
+ # 启动 Jupyter 进程
34
+ jupyter_process = subprocess.Popen(jupyter_command, shell=True)
35
+ #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=")
36
  notbook()
37
  ngrok_token = "2bgXLjjKFvxfbuZFlR2NMZkvL8n_4WrK7f15FLtWb8p7v3oaF"
38
  _ngrok_token = "2CXyNlT9xGfFoL5ruI6hQV20FNq_7tbmuzS9RtyNTkyEe1J6C"