update launch code
Browse files
files_cells/notebooks/en/launch_en.ipynb
CHANGED
@@ -29,7 +29,9 @@
|
|
29 |
"import time\n",
|
30 |
"import json\n",
|
31 |
"import requests\n",
|
|
|
32 |
"from datetime import timedelta\n",
|
|
|
33 |
"\n",
|
34 |
"\n",
|
35 |
"# ================= DETECT ENV =================\n",
|
@@ -62,7 +64,7 @@
|
|
62 |
"\n",
|
63 |
"\n",
|
64 |
"# ======================== TUNNEL ========================\n",
|
65 |
-
"
|
66 |
"\n",
|
67 |
"def get_public_ip(version='ipv4'):\n",
|
68 |
" try:\n",
|
@@ -77,7 +79,7 @@
|
|
77 |
"public_ipv4 = get_public_ip(version='ipv4')\n",
|
78 |
"\n",
|
79 |
"tunnel_class = pickle.load(open(f\"{root_path}/new_tunnel\", \"rb\"), encoding=\"utf-8\")\n",
|
80 |
-
"tunnel_port=
|
81 |
"tunnel = tunnel_class(tunnel_port)\n",
|
82 |
"tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
|
83 |
"tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
|
@@ -86,35 +88,38 @@
|
|
86 |
"if zrok_token:\n",
|
87 |
" get_ipython().system('zrok enable {zrok_token} &> /dev/null')\n",
|
88 |
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
|
|
|
|
89 |
"# ======================== TUNNEL ========================\n",
|
90 |
"\n",
|
91 |
"\n",
|
92 |
-
"# automatic fixing path V2\n",
|
93 |
"!sed -i 's|\"tagger_hf_cache_dir\": \".*\"|\"tagger_hf_cache_dir\": \"{webui_path}/models/interrogators/\"|' {webui_path}/config.json\n",
|
94 |
"!sed -i 's|\"additional_networks_extra_lora_path\": \".*\"|\"additional_networks_extra_lora_path\": \"{webui_path}/models/Lora/\"|' {webui_path}/config.json\n",
|
95 |
"!sed -i 's|\"ad_extra_models_dir\": \".*\"|\"ad_extra_models_dir\": \"{webui_path}/models/adetailer/\"|' {webui_path}/config.json\n",
|
96 |
-
"# ---\n",
|
97 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
98 |
"\n",
|
99 |
"\n",
|
100 |
"with tunnel:\n",
|
101 |
" %cd {webui_path}\n",
|
102 |
-
" commandline_arguments += f\" --port=1769\"\n",
|
103 |
"\n",
|
|
|
104 |
" if ngrok_token:\n",
|
105 |
-
" commandline_arguments += ' --ngrok '
|
106 |
" if env != \"Google Colab\":\n",
|
107 |
-
" commandline_arguments += f
|
108 |
"\n",
|
109 |
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
110 |
"\n",
|
111 |
-
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
112 |
-
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
113 |
-
" print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
114 |
"\n",
|
115 |
-
"
|
116 |
-
"
|
117 |
-
"
|
|
|
|
|
|
|
|
|
|
|
118 |
]
|
119 |
}
|
120 |
]
|
|
|
29 |
"import time\n",
|
30 |
"import json\n",
|
31 |
"import requests\n",
|
32 |
+
"import cloudpickle as pickle\n",
|
33 |
"from datetime import timedelta\n",
|
34 |
+
"from IPython.display import clear_output\n",
|
35 |
"\n",
|
36 |
"\n",
|
37 |
"# ================= DETECT ENV =================\n",
|
|
|
64 |
"\n",
|
65 |
"\n",
|
66 |
"# ======================== TUNNEL ========================\n",
|
67 |
+
"print('Please Wait...')\n",
|
68 |
"\n",
|
69 |
"def get_public_ip(version='ipv4'):\n",
|
70 |
" try:\n",
|
|
|
79 |
"public_ipv4 = get_public_ip(version='ipv4')\n",
|
80 |
"\n",
|
81 |
"tunnel_class = pickle.load(open(f\"{root_path}/new_tunnel\", \"rb\"), encoding=\"utf-8\")\n",
|
82 |
+
"tunnel_port= 1734\n",
|
83 |
"tunnel = tunnel_class(tunnel_port)\n",
|
84 |
"tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
|
85 |
"tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
|
|
|
88 |
"if zrok_token:\n",
|
89 |
" get_ipython().system('zrok enable {zrok_token} &> /dev/null')\n",
|
90 |
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
91 |
+
"\n",
|
92 |
+
"clear_output()\n",
|
93 |
"# ======================== TUNNEL ========================\n",
|
94 |
"\n",
|
95 |
"\n",
|
96 |
+
" # automatic fixing path V2\n",
|
97 |
"!sed -i 's|\"tagger_hf_cache_dir\": \".*\"|\"tagger_hf_cache_dir\": \"{webui_path}/models/interrogators/\"|' {webui_path}/config.json\n",
|
98 |
"!sed -i 's|\"additional_networks_extra_lora_path\": \".*\"|\"additional_networks_extra_lora_path\": \"{webui_path}/models/Lora/\"|' {webui_path}/config.json\n",
|
99 |
"!sed -i 's|\"ad_extra_models_dir\": \".*\"|\"ad_extra_models_dir\": \"{webui_path}/models/adetailer/\"|' {webui_path}/config.json\n",
|
|
|
100 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
101 |
"\n",
|
102 |
"\n",
|
103 |
"with tunnel:\n",
|
104 |
" %cd {webui_path}\n",
|
|
|
105 |
"\n",
|
106 |
+
" commandline_arguments += f' --port={tunnel_port}'\n",
|
107 |
" if ngrok_token:\n",
|
108 |
+
" commandline_arguments += f' --ngrok {ngrok_token}'\n",
|
109 |
" if env != \"Google Colab\":\n",
|
110 |
+
" commandline_arguments += f' --encrypt-pass={tunnel_port} --api'\n",
|
111 |
"\n",
|
112 |
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
113 |
"\n",
|
|
|
|
|
|
|
114 |
"\n",
|
115 |
+
"# after runnig\n",
|
116 |
+
"start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
117 |
+
"time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
118 |
+
"print(f\"\\n⌚️ \\033[0mYou have been conducting this session for - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
119 |
+
"\n",
|
120 |
+
"''' del zrok tunnel '''\n",
|
121 |
+
"if zrok_token:\n",
|
122 |
+
" !zrok disable &> /dev/null"
|
123 |
]
|
124 |
}
|
125 |
]
|
files_cells/notebooks/ru/launch_ru.ipynb
CHANGED
@@ -29,7 +29,9 @@
|
|
29 |
"import time\n",
|
30 |
"import json\n",
|
31 |
"import requests\n",
|
|
|
32 |
"from datetime import timedelta\n",
|
|
|
33 |
"\n",
|
34 |
"\n",
|
35 |
"# ================= DETECT ENV =================\n",
|
@@ -62,7 +64,7 @@
|
|
62 |
"\n",
|
63 |
"\n",
|
64 |
"# ======================== TUNNEL ========================\n",
|
65 |
-
"
|
66 |
"\n",
|
67 |
"def get_public_ip(version='ipv4'):\n",
|
68 |
" try:\n",
|
@@ -77,7 +79,7 @@
|
|
77 |
"public_ipv4 = get_public_ip(version='ipv4')\n",
|
78 |
"\n",
|
79 |
"tunnel_class = pickle.load(open(f\"{root_path}/new_tunnel\", \"rb\"), encoding=\"utf-8\")\n",
|
80 |
-
"tunnel_port=
|
81 |
"tunnel = tunnel_class(tunnel_port)\n",
|
82 |
"tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
|
83 |
"tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
|
@@ -86,6 +88,8 @@
|
|
86 |
"if zrok_token:\n",
|
87 |
" get_ipython().system('zrok enable {zrok_token} &> /dev/null')\n",
|
88 |
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
|
|
|
|
89 |
"# ======================== TUNNEL ========================\n",
|
90 |
"\n",
|
91 |
"\n",
|
@@ -93,28 +97,29 @@
|
|
93 |
"!sed -i 's|\"tagger_hf_cache_dir\": \".*\"|\"tagger_hf_cache_dir\": \"{webui_path}/models/interrogators/\"|' {webui_path}/config.json\n",
|
94 |
"!sed -i 's|\"additional_networks_extra_lora_path\": \".*\"|\"additional_networks_extra_lora_path\": \"{webui_path}/models/Lora/\"|' {webui_path}/config.json\n",
|
95 |
"!sed -i 's|\"ad_extra_models_dir\": \".*\"|\"ad_extra_models_dir\": \"{webui_path}/models/adetailer/\"|' {webui_path}/config.json\n",
|
96 |
-
"# ---\n",
|
97 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
98 |
"\n",
|
99 |
"\n",
|
100 |
"with tunnel:\n",
|
101 |
" %cd {webui_path}\n",
|
102 |
-
" commandline_arguments += f\" --port=1769\"\n",
|
103 |
"\n",
|
|
|
104 |
" if ngrok_token:\n",
|
105 |
-
" commandline_arguments += ' --ngrok '
|
106 |
" if env != \"Google Colab\":\n",
|
107 |
-
" commandline_arguments += f
|
108 |
"\n",
|
109 |
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
110 |
"\n",
|
111 |
-
" start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
112 |
-
" time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
113 |
-
" print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
114 |
"\n",
|
115 |
-
"
|
116 |
-
"
|
117 |
-
"
|
|
|
|
|
|
|
|
|
|
|
118 |
]
|
119 |
}
|
120 |
]
|
|
|
29 |
"import time\n",
|
30 |
"import json\n",
|
31 |
"import requests\n",
|
32 |
+
"import cloudpickle as pickle\n",
|
33 |
"from datetime import timedelta\n",
|
34 |
+
"from IPython.display import clear_output\n",
|
35 |
"\n",
|
36 |
"\n",
|
37 |
"# ================= DETECT ENV =================\n",
|
|
|
64 |
"\n",
|
65 |
"\n",
|
66 |
"# ======================== TUNNEL ========================\n",
|
67 |
+
"print('Please Wait...')\n",
|
68 |
"\n",
|
69 |
"def get_public_ip(version='ipv4'):\n",
|
70 |
" try:\n",
|
|
|
79 |
"public_ipv4 = get_public_ip(version='ipv4')\n",
|
80 |
"\n",
|
81 |
"tunnel_class = pickle.load(open(f\"{root_path}/new_tunnel\", \"rb\"), encoding=\"utf-8\")\n",
|
82 |
+
"tunnel_port= 1734\n",
|
83 |
"tunnel = tunnel_class(tunnel_port)\n",
|
84 |
"tunnel.add_tunnel(command=\"cl tunnel --url localhost:{port}\", name=\"cl\", pattern=re.compile(r\"[\\w-]+\\.trycloudflare\\.com\"))\n",
|
85 |
"tunnel.add_tunnel(command=\"lt --port {port}\", name=\"lt\", pattern=re.compile(r\"[\\w-]+\\.loca\\.lt\"), note=\"Password : \" + \"\\033[32m\" + public_ipv4 + \"\\033[0m\" + \" rerun cell if 404 error.\")\n",
|
|
|
88 |
"if zrok_token:\n",
|
89 |
" get_ipython().system('zrok enable {zrok_token} &> /dev/null')\n",
|
90 |
" tunnel.add_tunnel(command=\"zrok share public http://localhost:{port}/ --headless\", name=\"zrok\", pattern=re.compile(r\"[\\w-]+\\.share\\.zrok\\.io\"))\n",
|
91 |
+
"\n",
|
92 |
+
"clear_output()\n",
|
93 |
"# ======================== TUNNEL ========================\n",
|
94 |
"\n",
|
95 |
"\n",
|
|
|
97 |
"!sed -i 's|\"tagger_hf_cache_dir\": \".*\"|\"tagger_hf_cache_dir\": \"{webui_path}/models/interrogators/\"|' {webui_path}/config.json\n",
|
98 |
"!sed -i 's|\"additional_networks_extra_lora_path\": \".*\"|\"additional_networks_extra_lora_path\": \"{webui_path}/models/Lora/\"|' {webui_path}/config.json\n",
|
99 |
"!sed -i 's|\"ad_extra_models_dir\": \".*\"|\"ad_extra_models_dir\": \"{webui_path}/models/adetailer/\"|' {webui_path}/config.json\n",
|
|
|
100 |
"!sed -i 's/\"sd_checkpoint_hash\": \".*\"/\"sd_checkpoint_hash\": \"\"/g; s/\"sd_model_checkpoint\": \".*\"/\"sd_model_checkpoint\": \"\"/g; s/\"sd_vae\": \".*\"/\"sd_vae\": \"None\"/g' {webui_path}/config.json\n",
|
101 |
"\n",
|
102 |
"\n",
|
103 |
"with tunnel:\n",
|
104 |
" %cd {webui_path}\n",
|
|
|
105 |
"\n",
|
106 |
+
" commandline_arguments += f' --port={tunnel_port}'\n",
|
107 |
" if ngrok_token:\n",
|
108 |
+
" commandline_arguments += f' --ngrok {ngrok_token}'\n",
|
109 |
" if env != \"Google Colab\":\n",
|
110 |
+
" commandline_arguments += f' --encrypt-pass={tunnel_port} --api'\n",
|
111 |
"\n",
|
112 |
" !COMMANDLINE_ARGS=\"{commandline_arguments}\" python launch.py\n",
|
113 |
"\n",
|
|
|
|
|
|
|
114 |
"\n",
|
115 |
+
"# after runnig\n",
|
116 |
+
"start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())\n",
|
117 |
+
"time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]\n",
|
118 |
+
"print(f\"\\n⌚️ \\033[0mВы проводите эту сессию в течение - \\033[33m{time_since_start}\\033[0m\\n\\n\")\n",
|
119 |
+
"\n",
|
120 |
+
"''' del zrok tunnel '''\n",
|
121 |
+
"if zrok_token:\n",
|
122 |
+
" !zrok disable &> /dev/null"
|
123 |
]
|
124 |
}
|
125 |
]
|
files_cells/python/en/launch_en.py
CHANGED
@@ -5,7 +5,9 @@ import re
|
|
5 |
import time
|
6 |
import json
|
7 |
import requests
|
|
|
8 |
from datetime import timedelta
|
|
|
9 |
|
10 |
|
11 |
# ================= DETECT ENV =================
|
@@ -38,7 +40,7 @@ commandline_arguments = settings['commandline_arguments']
|
|
38 |
|
39 |
|
40 |
# ======================== TUNNEL ========================
|
41 |
-
|
42 |
|
43 |
def get_public_ip(version='ipv4'):
|
44 |
try:
|
@@ -53,7 +55,7 @@ def get_public_ip(version='ipv4'):
|
|
53 |
public_ipv4 = get_public_ip(version='ipv4')
|
54 |
|
55 |
tunnel_class = pickle.load(open(f"{root_path}/new_tunnel", "rb"), encoding="utf-8")
|
56 |
-
tunnel_port=
|
57 |
tunnel = tunnel_class(tunnel_port)
|
58 |
tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
|
59 |
tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
|
@@ -62,33 +64,36 @@ tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\
|
|
62 |
if zrok_token:
|
63 |
get_ipython().system('zrok enable {zrok_token} &> /dev/null')
|
64 |
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
|
|
|
|
65 |
# ======================== TUNNEL ========================
|
66 |
|
67 |
|
68 |
-
# automatic fixing path V2
|
69 |
get_ipython().system('sed -i \'s|"tagger_hf_cache_dir": ".*"|"tagger_hf_cache_dir": "{webui_path}/models/interrogators/"|\' {webui_path}/config.json')
|
70 |
get_ipython().system('sed -i \'s|"additional_networks_extra_lora_path": ".*"|"additional_networks_extra_lora_path": "{webui_path}/models/Lora/"|\' {webui_path}/config.json')
|
71 |
get_ipython().system('sed -i \'s|"ad_extra_models_dir": ".*"|"ad_extra_models_dir": "{webui_path}/models/adetailer/"|\' {webui_path}/config.json')
|
72 |
-
# ---
|
73 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
74 |
|
75 |
|
76 |
with tunnel:
|
77 |
get_ipython().run_line_magic('cd', '{webui_path}')
|
78 |
-
commandline_arguments += f" --port=1769"
|
79 |
|
|
|
80 |
if ngrok_token:
|
81 |
-
commandline_arguments += ' --ngrok '
|
82 |
if env != "Google Colab":
|
83 |
-
commandline_arguments += f
|
84 |
|
85 |
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
86 |
|
87 |
-
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
88 |
-
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
89 |
-
print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
94 |
|
|
|
5 |
import time
|
6 |
import json
|
7 |
import requests
|
8 |
+
import cloudpickle as pickle
|
9 |
from datetime import timedelta
|
10 |
+
from IPython.display import clear_output
|
11 |
|
12 |
|
13 |
# ================= DETECT ENV =================
|
|
|
40 |
|
41 |
|
42 |
# ======================== TUNNEL ========================
|
43 |
+
print('Please Wait...')
|
44 |
|
45 |
def get_public_ip(version='ipv4'):
|
46 |
try:
|
|
|
55 |
public_ipv4 = get_public_ip(version='ipv4')
|
56 |
|
57 |
tunnel_class = pickle.load(open(f"{root_path}/new_tunnel", "rb"), encoding="utf-8")
|
58 |
+
tunnel_port= 1734
|
59 |
tunnel = tunnel_class(tunnel_port)
|
60 |
tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
|
61 |
tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
|
|
|
64 |
if zrok_token:
|
65 |
get_ipython().system('zrok enable {zrok_token} &> /dev/null')
|
66 |
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
67 |
+
|
68 |
+
clear_output()
|
69 |
# ======================== TUNNEL ========================
|
70 |
|
71 |
|
72 |
+
# automatic fixing path V2
|
73 |
get_ipython().system('sed -i \'s|"tagger_hf_cache_dir": ".*"|"tagger_hf_cache_dir": "{webui_path}/models/interrogators/"|\' {webui_path}/config.json')
|
74 |
get_ipython().system('sed -i \'s|"additional_networks_extra_lora_path": ".*"|"additional_networks_extra_lora_path": "{webui_path}/models/Lora/"|\' {webui_path}/config.json')
|
75 |
get_ipython().system('sed -i \'s|"ad_extra_models_dir": ".*"|"ad_extra_models_dir": "{webui_path}/models/adetailer/"|\' {webui_path}/config.json')
|
|
|
76 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
77 |
|
78 |
|
79 |
with tunnel:
|
80 |
get_ipython().run_line_magic('cd', '{webui_path}')
|
|
|
81 |
|
82 |
+
commandline_arguments += f' --port={tunnel_port}'
|
83 |
if ngrok_token:
|
84 |
+
commandline_arguments += f' --ngrok {ngrok_token}'
|
85 |
if env != "Google Colab":
|
86 |
+
commandline_arguments += f' --encrypt-pass={tunnel_port} --api'
|
87 |
|
88 |
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
+
# after runnig
|
92 |
+
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
93 |
+
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
94 |
+
print(f"\n⌚️ \033[0mYou have been conducting this session for - \033[33m{time_since_start}\033[0m\n\n")
|
95 |
+
|
96 |
+
''' del zrok tunnel '''
|
97 |
+
if zrok_token:
|
98 |
+
get_ipython().system('zrok disable &> /dev/null')
|
99 |
|
files_cells/python/ru/launch_ru.py
CHANGED
@@ -5,7 +5,9 @@ import re
|
|
5 |
import time
|
6 |
import json
|
7 |
import requests
|
|
|
8 |
from datetime import timedelta
|
|
|
9 |
|
10 |
|
11 |
# ================= DETECT ENV =================
|
@@ -38,7 +40,7 @@ commandline_arguments = settings['commandline_arguments']
|
|
38 |
|
39 |
|
40 |
# ======================== TUNNEL ========================
|
41 |
-
|
42 |
|
43 |
def get_public_ip(version='ipv4'):
|
44 |
try:
|
@@ -53,7 +55,7 @@ def get_public_ip(version='ipv4'):
|
|
53 |
public_ipv4 = get_public_ip(version='ipv4')
|
54 |
|
55 |
tunnel_class = pickle.load(open(f"{root_path}/new_tunnel", "rb"), encoding="utf-8")
|
56 |
-
tunnel_port=
|
57 |
tunnel = tunnel_class(tunnel_port)
|
58 |
tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
|
59 |
tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
|
@@ -62,6 +64,8 @@ tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\
|
|
62 |
if zrok_token:
|
63 |
get_ipython().system('zrok enable {zrok_token} &> /dev/null')
|
64 |
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
|
|
|
|
65 |
# ======================== TUNNEL ========================
|
66 |
|
67 |
|
@@ -69,26 +73,27 @@ if zrok_token:
|
|
69 |
get_ipython().system('sed -i \'s|"tagger_hf_cache_dir": ".*"|"tagger_hf_cache_dir": "{webui_path}/models/interrogators/"|\' {webui_path}/config.json')
|
70 |
get_ipython().system('sed -i \'s|"additional_networks_extra_lora_path": ".*"|"additional_networks_extra_lora_path": "{webui_path}/models/Lora/"|\' {webui_path}/config.json')
|
71 |
get_ipython().system('sed -i \'s|"ad_extra_models_dir": ".*"|"ad_extra_models_dir": "{webui_path}/models/adetailer/"|\' {webui_path}/config.json')
|
72 |
-
# ---
|
73 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
74 |
|
75 |
|
76 |
with tunnel:
|
77 |
get_ipython().run_line_magic('cd', '{webui_path}')
|
78 |
-
commandline_arguments += f" --port=1769"
|
79 |
|
|
|
80 |
if ngrok_token:
|
81 |
-
commandline_arguments += ' --ngrok '
|
82 |
if env != "Google Colab":
|
83 |
-
commandline_arguments += f
|
84 |
|
85 |
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
86 |
|
87 |
-
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
88 |
-
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
89 |
-
print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
94 |
|
|
|
5 |
import time
|
6 |
import json
|
7 |
import requests
|
8 |
+
import cloudpickle as pickle
|
9 |
from datetime import timedelta
|
10 |
+
from IPython.display import clear_output
|
11 |
|
12 |
|
13 |
# ================= DETECT ENV =================
|
|
|
40 |
|
41 |
|
42 |
# ======================== TUNNEL ========================
|
43 |
+
print('Please Wait...')
|
44 |
|
45 |
def get_public_ip(version='ipv4'):
|
46 |
try:
|
|
|
55 |
public_ipv4 = get_public_ip(version='ipv4')
|
56 |
|
57 |
tunnel_class = pickle.load(open(f"{root_path}/new_tunnel", "rb"), encoding="utf-8")
|
58 |
+
tunnel_port= 1734
|
59 |
tunnel = tunnel_class(tunnel_port)
|
60 |
tunnel.add_tunnel(command="cl tunnel --url localhost:{port}", name="cl", pattern=re.compile(r"[\w-]+\.trycloudflare\.com"))
|
61 |
tunnel.add_tunnel(command="lt --port {port}", name="lt", pattern=re.compile(r"[\w-]+\.loca\.lt"), note="Password : " + "\033[32m" + public_ipv4 + "\033[0m" + " rerun cell if 404 error.")
|
|
|
64 |
if zrok_token:
|
65 |
get_ipython().system('zrok enable {zrok_token} &> /dev/null')
|
66 |
tunnel.add_tunnel(command="zrok share public http://localhost:{port}/ --headless", name="zrok", pattern=re.compile(r"[\w-]+\.share\.zrok\.io"))
|
67 |
+
|
68 |
+
clear_output()
|
69 |
# ======================== TUNNEL ========================
|
70 |
|
71 |
|
|
|
73 |
get_ipython().system('sed -i \'s|"tagger_hf_cache_dir": ".*"|"tagger_hf_cache_dir": "{webui_path}/models/interrogators/"|\' {webui_path}/config.json')
|
74 |
get_ipython().system('sed -i \'s|"additional_networks_extra_lora_path": ".*"|"additional_networks_extra_lora_path": "{webui_path}/models/Lora/"|\' {webui_path}/config.json')
|
75 |
get_ipython().system('sed -i \'s|"ad_extra_models_dir": ".*"|"ad_extra_models_dir": "{webui_path}/models/adetailer/"|\' {webui_path}/config.json')
|
|
|
76 |
get_ipython().system('sed -i \'s/"sd_checkpoint_hash": ".*"/"sd_checkpoint_hash": ""/g; s/"sd_model_checkpoint": ".*"/"sd_model_checkpoint": ""/g; s/"sd_vae": ".*"/"sd_vae": "None"/g\' {webui_path}/config.json')
|
77 |
|
78 |
|
79 |
with tunnel:
|
80 |
get_ipython().run_line_magic('cd', '{webui_path}')
|
|
|
81 |
|
82 |
+
commandline_arguments += f' --port={tunnel_port}'
|
83 |
if ngrok_token:
|
84 |
+
commandline_arguments += f' --ngrok {ngrok_token}'
|
85 |
if env != "Google Colab":
|
86 |
+
commandline_arguments += f' --encrypt-pass={tunnel_port} --api'
|
87 |
|
88 |
get_ipython().system('COMMANDLINE_ARGS="{commandline_arguments}" python launch.py')
|
89 |
|
|
|
|
|
|
|
90 |
|
91 |
+
# after runnig
|
92 |
+
start_colab = float(open(f'{webui_path}/static/colabTimer.txt', 'r').read())
|
93 |
+
time_since_start = str(timedelta(seconds=time.time()-start_colab)).split('.')[0]
|
94 |
+
print(f"\n⌚️ \033[0mВы проводите эту сессию в течение - \033[33m{time_since_start}\033[0m\n\n")
|
95 |
+
|
96 |
+
''' del zrok tunnel '''
|
97 |
+
if zrok_token:
|
98 |
+
get_ipython().system('zrok disable &> /dev/null')
|
99 |
|