默认暗色护眼主题

This commit is contained in:
qingxu fu 2023-04-03 20:56:00 +08:00
parent f1b0e5f0f7
commit 23c1b14ca3

View File

@ -134,10 +134,12 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False, css=advanced_css) as de
# gradio的inbrowser触发不太稳定回滚代码到原始的浏览器打开函数
def auto_opentab_delay():
import threading, webbrowser, time
print(f"如果浏览器没有自动打开请复制并转到以下URL: http://localhost:{PORT}")
print(f"如果浏览器没有自动打开请复制并转到以下URL")
print(f"\t(亮色主体): http://localhost:{PORT}")
print(f"\t(暗色主体): http://localhost:{PORT}/?__dark-theme=true")
def open():
time.sleep(2)
webbrowser.open_new_tab(f"http://localhost:{PORT}")
webbrowser.open_new_tab(f"http://localhost:{PORT}/?__dark-theme=true")
threading.Thread(target=open, name="open-browser", daemon=True).start()
auto_opentab_delay()