Update launch.py
Browse files
launch.py
CHANGED
@@ -3,8 +3,6 @@ from modules import launch_utils
|
|
3 |
import os
|
4 |
import subprocess
|
5 |
import threading
|
6 |
-
import logging
|
7 |
-
import sys
|
8 |
|
9 |
# 设置启动参数
|
10 |
args = launch_utils.args
|
@@ -16,7 +14,6 @@ args.gradio_queue = True
|
|
16 |
args.multiple = True
|
17 |
args.no_download_sd_model = True
|
18 |
args.share = True
|
19 |
-
args.share = "/bushu/out_url.txt"
|
20 |
|
21 |
python = launch_utils.python
|
22 |
git = launch_utils.git
|
@@ -42,17 +39,6 @@ start = launch_utils.start
|
|
42 |
|
43 |
util_py_path = '/bushu/ui/repositories/diffusion-stability-stable/ldm/util.py'
|
44 |
|
45 |
-
# 创建一个将输出同时发送到控制台和日志文件的处理程序
|
46 |
-
console_handler = logging.StreamHandler(sys.stdout)
|
47 |
-
console_handler.setLevel(logging.INFO)
|
48 |
-
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
|
49 |
-
console_handler.setFormatter(formatter)
|
50 |
-
logging.getLogger().addHandler(console_handler)
|
51 |
-
|
52 |
-
# 重定向标准输出和标准错误到日志文件和控制台
|
53 |
-
sys.stdout = logging.getLogger().handlers[0].stream
|
54 |
-
sys.stderr = logging.getLogger().handlers[0].stream
|
55 |
-
|
56 |
# 创建主程序函数
|
57 |
def main():
|
58 |
# 创建线程用于实时查找并打印链接
|
@@ -63,23 +49,9 @@ def main():
|
|
63 |
# 主程序代码块
|
64 |
# 这里包含了原来在 if __name__ == "__main__": 中的代码
|
65 |
|
66 |
-
# 创建线程用于实时查找并打印链接
|
67 |
-
def find_and_print_links():
|
68 |
-
while True:
|
69 |
-
line = log_process.stdout.readline()
|
70 |
-
if "Public WebUI Colab URL" in line:
|
71 |
-
url = line.split("Public WebUI Colab URL: ")[1].strip()
|
72 |
-
print(url) # 在控制台中显示链接
|
73 |
-
else:
|
74 |
-
# 将其他消息记录到日志文件
|
75 |
-
log_file.write(line)
|
76 |
-
log_file.flush()
|
77 |
-
|
78 |
# 设置标志变量来确定是否执行主程序
|
79 |
run_main = True
|
80 |
|
81 |
if __name__ == "__main__":
|
82 |
run_main = True # 如果直接运行 launch.py,则设置为 True
|
83 |
-
main()
|
84 |
-
|
85 |
-
# 其他模块导入语句
|
|
|
3 |
import os
|
4 |
import subprocess
|
5 |
import threading
|
|
|
|
|
6 |
|
7 |
# 设置启动参数
|
8 |
args = launch_utils.args
|
|
|
14 |
args.multiple = True
|
15 |
args.no_download_sd_model = True
|
16 |
args.share = True
|
|
|
17 |
|
18 |
python = launch_utils.python
|
19 |
git = launch_utils.git
|
|
|
39 |
|
40 |
util_py_path = '/bushu/ui/repositories/diffusion-stability-stable/ldm/util.py'
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
# 创建主程序函数
|
43 |
def main():
|
44 |
# 创建线程用于实时查找并打印链接
|
|
|
49 |
# 主程序代码块
|
50 |
# 这里包含了原来在 if __name__ == "__main__": 中的代码
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
# 设置标志变量来确定是否执行主程序
|
53 |
run_main = True
|
54 |
|
55 |
if __name__ == "__main__":
|
56 |
run_main = True # 如果直接运行 launch.py,则设置为 True
|
57 |
+
main()
|
|
|
|