unifying code

This commit is contained in:
Your Name
2023-04-22 17:24:22 +08:00
parent 6f7e8076c7
commit 7beea951c6
3 changed files with 12 additions and 11 deletions

View File

@ -176,18 +176,18 @@ def main():
def auto_opentab_delay():
import threading, webbrowser, time
print(f"如果浏览器没有自动打开请复制并转到以下URL")
print(f"\t(亮色主题): http://localhost:{PORT}")
print(f"\t(暗色主题): http://localhost:{PORT}/?__dark-theme=true")
print(f"\t(亮色主题): http://localhost:{PORT}" + f"{CUSTOM_PATH}".replace('//','/'))
print(f"\t(暗色主题): http://localhost:{PORT}" + f"{CUSTOM_PATH}/?__dark-theme=true".replace('//','/'))
def open():
time.sleep(2) # 打开浏览器
webbrowser.open_new_tab(f"http://localhost:{PORT}/?__dark-theme=true")
webbrowser.open_new_tab(f"http://localhost:{PORT}" + f"{CUSTOM_PATH}/?__dark-theme=true".replace('//','/'))
threading.Thread(target=open, name="open-browser", daemon=True).start()
threading.Thread(target=auto_update, name="self-upgrade", daemon=True).start()
threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()
auto_opentab_delay()
demo.queue(concurrency_count=CONCURRENT_COUNT)
run_gradio(demo, auth=AUTHENTICATION, favicon_path="docs/logo.png", port=PORT, custom_path=CUSTOM_PATH)
run_gradio(demo, auth=AUTHENTICATION, port=PORT, custom_path=CUSTOM_PATH)
if __name__ == "__main__":
main()