Update webui.py
Browse files
webui.py
CHANGED
|
@@ -6,19 +6,8 @@ import time
|
|
| 6 |
from modules import timer
|
| 7 |
from modules import initialize_util
|
| 8 |
from modules import initialize
|
| 9 |
-
from pathlib import Path
|
| 10 |
|
| 11 |
-
ngrok_use =
|
| 12 |
-
|
| 13 |
-
# 打开并执行txt文件
|
| 14 |
-
with open('/etc/main/StartBianLiang.txt', 'r') as file:
|
| 15 |
-
code = file.read()
|
| 16 |
-
|
| 17 |
-
# 去除每行开头和结尾的空格、空行等
|
| 18 |
-
cleaned_code = '\n'.join(line.strip() for line in code.splitlines() if line.strip())
|
| 19 |
-
|
| 20 |
-
# 执行干净的代码
|
| 21 |
-
exec(cleaned_code)
|
| 22 |
|
| 23 |
#ngrok穿透
|
| 24 |
ngrokTokenFile='/etc/main/Authtoken.txt' # 非必填 存放ngrokToken的文件的路径
|
|
@@ -43,8 +32,8 @@ def ngrok_start(ngrokTokenFile: str, port: int, address_name: str, should_run: b
|
|
| 43 |
else:
|
| 44 |
print('skip start ngrok')
|
| 45 |
|
| 46 |
-
if ngrok_use
|
| 47 |
-
ngrok_start(ngrokTokenFile,7860,'
|
| 48 |
|
| 49 |
startup_timer = timer.startup_timer
|
| 50 |
startup_timer.record("launcher")
|
|
@@ -100,7 +89,7 @@ def webui():
|
|
| 100 |
script_callbacks.before_ui_callback()
|
| 101 |
startup_timer.record("scripts before_ui_callback")
|
| 102 |
|
| 103 |
-
shared.demo = ui.create_ui()
|
| 104 |
startup_timer.record("create ui")
|
| 105 |
|
| 106 |
if not cmd_opts.no_gradio_queue:
|
|
@@ -192,17 +181,10 @@ def webui():
|
|
| 192 |
initialize.initialize_rest(reload_script_modules=True)
|
| 193 |
|
| 194 |
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
if cmd_opts.nowebui:
|
| 198 |
-
api_only()
|
| 199 |
-
else:
|
| 200 |
-
webui()
|
| 201 |
-
|
| 202 |
-
#if __name__ == "__main__":
|
| 203 |
-
# from modules.shared_cmd_options import cmd_opts#
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
| 6 |
from modules import timer
|
| 7 |
from modules import initialize_util
|
| 8 |
from modules import initialize
|
|
|
|
| 9 |
|
| 10 |
+
ngrok_use = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
#ngrok穿透
|
| 13 |
ngrokTokenFile='/etc/main/Authtoken.txt' # 非必填 存放ngrokToken的文件的路径
|
|
|
|
| 32 |
else:
|
| 33 |
print('skip start ngrok')
|
| 34 |
|
| 35 |
+
if ngrok_use == True:
|
| 36 |
+
ngrok_start(ngrokTokenFile,7860,'',ngrok_use)
|
| 37 |
|
| 38 |
startup_timer = timer.startup_timer
|
| 39 |
startup_timer.record("launcher")
|
|
|
|
| 89 |
script_callbacks.before_ui_callback()
|
| 90 |
startup_timer.record("scripts before_ui_callback")
|
| 91 |
|
| 92 |
+
shared.demo = ui.create_ui();shared.demo.queue(concurrency_count=999999,status_update_rate=0.1)
|
| 93 |
startup_timer.record("create ui")
|
| 94 |
|
| 95 |
if not cmd_opts.no_gradio_queue:
|
|
|
|
| 181 |
initialize.initialize_rest(reload_script_modules=True)
|
| 182 |
|
| 183 |
|
| 184 |
+
if __name__ == "__main__":
|
| 185 |
+
from modules.shared_cmd_options import cmd_opts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
+
if cmd_opts.nowebui:
|
| 188 |
+
api_only()
|
| 189 |
+
else:
|
| 190 |
+
webui()
|