From b0dfef48e9b81afb389e88ef26d5d901e1c1c33c Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 1 Apr 2023 03:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86css=E6=A0=B7=E5=BC=8F=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0theme=E6=96=87=E4=BB=B6=EF=BC=8C=E5=87=8F?= =?UTF-8?q?=E5=B0=91main.py=E7=9A=84=E4=BB=A3=E7=A0=81=E8=A1=8C=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 16 ++-------------- theme.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 23f848b..08cf2fb 100644 --- a/main.py +++ b/main.py @@ -33,23 +33,11 @@ crazy_fns = get_crazy_functionals() gr.Chatbot.postprocess = format_io # 做一些外观色彩上的调整 -from theme import adjust_theme +from theme import adjust_theme, advanced_css set_theme = adjust_theme() -CSS = """ -.markdown-body table { - border: 1px solid #ddd; - border-collapse: collapse; -} - -.markdown-body th, .markdown-body td { - border: 1px solid #ddd; - padding: 5px; -} -""" - cancel_handles = [] -with gr.Blocks(theme=set_theme, analytics_enabled=False, css=CSS) as demo: +with gr.Blocks(theme=set_theme, analytics_enabled=False, css=advanced_css) as demo: gr.HTML(title_html) with gr.Row().style(equal_height=True): with gr.Column(scale=2): diff --git a/theme.py b/theme.py index d7544ed..14f16fb 100644 --- a/theme.py +++ b/theme.py @@ -80,3 +80,15 @@ def adjust_theme(): except: set_theme = None; print('gradio版本较旧, 不能自定义字体和颜色') return set_theme + +advanced_css = """ +.markdown-body table { + border: 1px solid #ddd; + border-collapse: collapse; +} + +.markdown-body th, .markdown-body td { + border: 1px solid #ddd; + padding: 5px; +} +""" \ No newline at end of file