Disable Gradio analytics and unnecessary font loading to avoid app hanging in private network (#145)

This commit is contained in:
Duc Nguyen (john) 2024-02-20 22:02:28 +07:00 committed by GitHub
parent 08cc99d8db
commit e1cf970a3d

View File

@ -35,6 +35,10 @@ class BaseApp:
def __init__(self):
self.dev_mode = getattr(settings, "KH_MODE", "") == "dev"
self._theme = gr.themes.Base(
font=("ui-sans-serif", "system-ui", "sans-serif"),
font_mono=("ui-monospace", "Consolas", "monospace"),
)
dir_assets = Path(__file__).parent / "assets"
with (dir_assets / "css" / "main.css").open() as fi:
@ -140,7 +144,12 @@ class BaseApp:
raise NotImplementedError
def make(self):
with gr.Blocks(css=self._css, title="Kotaemon") as demo:
with gr.Blocks(
theme=self._theme,
css=self._css,
title="Kotaemon",
analytics_enabled=False,
) as demo:
self.app = demo
self.settings_state.render()
self.user_id.render()