Commit 867be742 authored by catboxanon's avatar catboxanon
Browse files

Define default fonts for Gradio theme

Allows web UI to (almost) be ran fully offline.
The web UI will hang on load if offline when
these fonts are not manually defined, as it will attempt (and fail)
to pull from Google Fonts.
parent b14e2352
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -666,13 +666,19 @@ def reload_gradio_theme(theme_name=None):
        theme_name = opts.gradio_theme

    if theme_name == "Default":
        gradio_theme = gr.themes.Default()
        gradio_theme = gr.themes.Default(
            font=['Helvetica', 'ui-sans-serif', 'system-ui', 'sans-serif'],
            font_mono=['IBM Plex Mono', 'ui-monospace', 'Consolas', 'monospace'],
        )
    else:
        try:
            gradio_theme = gr.themes.ThemeClass.from_hub(theme_name)
        except Exception as e:
            errors.display(e, "changing gradio theme")
            gradio_theme = gr.themes.Default()
            gradio_theme = gr.themes.Default(
                font=['Helvetica', 'ui-sans-serif', 'system-ui', 'sans-serif'],
                font_mono=['IBM Plex Mono', 'ui-monospace', 'Consolas', 'monospace'],
            )