BBrother commited on
Commit
f1b9988
1 Parent(s): 0914440

Update launch.py

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