change default path to relative

This commit is contained in:
binary-husky 2023-10-21 00:27:55 +08:00
parent ff2bc64d57
commit 991e41b313
2 changed files with 6 additions and 5 deletions

View File

@ -431,7 +431,7 @@ def main():
ssl_certfile=None if SSL_CERTFILE == "" else SSL_CERTFILE,
ssl_verify=False,
server_port=PORT,
favicon_path="docs/logo.png",
favicon_path=os.path.join(os.path.dirname(__file__), "docs/logo.png"),
auth=AUTHENTICATION if len(AUTHENTICATION) != 0 else None,
blocked_paths=["config.py","config_private.py","docker-compose.yml","Dockerfile"])

View File

@ -1,7 +1,8 @@
import os
import gradio as gr
from toolbox import get_conf
CODE_HIGHLIGHT, ADD_WAIFU, LAYOUT = get_conf('CODE_HIGHLIGHT', 'ADD_WAIFU', 'LAYOUT')
theme_dir = os.path.dirname(__file__)
def adjust_theme():
try:
@ -57,7 +58,7 @@ def adjust_theme():
button_cancel_text_color_dark="white",
)
with open('themes/common.js', 'r', encoding='utf8') as f:
with open(os.path.join(theme_dir, 'common.js'), 'r', encoding='utf8') as f:
js = f"<script>{f.read()}</script>"
# 添加一个萌萌的看板娘
@ -79,7 +80,7 @@ def adjust_theme():
print('gradio版本较旧, 不能自定义字体和颜色')
return set_theme
with open("themes/default.css", "r", encoding="utf-8") as f:
with open(os.path.join(theme_dir, 'default.css'), "r", encoding="utf-8") as f:
advanced_css = f.read()
with open("themes/common.css", "r", encoding="utf-8") as f:
with open(os.path.join(theme_dir, 'common.css'), "r", encoding="utf-8") as f:
advanced_css += f.read()