Chuan Hu commited on
Commit
954bc36
1 Parent(s): c06c60b

Improve the way to open webbrowser

Browse files
Files changed (1) hide show
  1. main.py +1 -11
main.py CHANGED
@@ -89,15 +89,5 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
89
  except: pass
90
 
91
 
92
- # 延迟函数, 做一些准备工作, 最后尝试打开浏览器
93
- def auto_opentab_delay():
94
- import threading, webbrowser, time
95
- print(f"URL http://localhost:{PORT}")
96
- def open(): time.sleep(2)
97
- webbrowser.open_new_tab(f'http://localhost:{PORT}')
98
- t = threading.Thread(target=open)
99
- t.daemon = True; t.start()
100
-
101
- auto_opentab_delay()
102
  demo.title = "ChatGPT 学术优化"
103
- demo.queue().launch(server_name="0.0.0.0", share=True, server_port=PORT)
 
89
  except: pass
90
 
91
 
 
 
 
 
 
 
 
 
 
 
92
  demo.title = "ChatGPT 学术优化"
93
+ demo.queue().launch(server_name="0.0.0.0", share=True, server_port=PORT, inbrowser=True)