Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- app.py +10 -7
__pycache__/app.cpython-311.pyc
CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
app.py
CHANGED
@@ -102,8 +102,8 @@ with gr.Blocks( # noqa: SIM117
|
|
102 |
load_theme_btn = gr.Button("Load Theme", elem_id="load_theme")
|
103 |
gr.Markdown(
|
104 |
"""
|
105 |
-
|
106 |
-
|
107 |
)
|
108 |
|
109 |
custom_theme_name = gr.Textbox(
|
@@ -506,12 +506,13 @@ with gr.Blocks( # noqa: SIM117
|
|
506 |
)
|
507 |
|
508 |
def load_theme(theme_name, custom_theme: gr.themes.Base = None):
|
|
|
509 |
if custom_theme:
|
510 |
theme = custom_theme
|
511 |
else:
|
512 |
theme = [theme for theme in themes if theme.__name__ == theme_name][0]
|
513 |
theme = theme()
|
514 |
-
|
515 |
parameters = inspect.signature(theme.__init__).parameters
|
516 |
primary_hue = parameters["primary_hue"].default
|
517 |
secondary_hue = parameters["secondary_hue"].default
|
@@ -556,14 +557,12 @@ with gr.Blocks( # noqa: SIM117
|
|
556 |
)
|
557 |
|
558 |
def load_custom_theme(custom_theme_name):
|
559 |
-
print("
|
560 |
theme = gr.Theme.from_hub(custom_theme_name)
|
561 |
-
print("loaded custom theme")
|
562 |
return load_theme(theme.name, theme)
|
563 |
|
564 |
|
565 |
-
load_custom_theme_btn.click(load_custom_theme, custom_theme_name, theme_inputs, show_api=False)
|
566 |
-
|
567 |
def generate_theme_code(
|
568 |
base_theme, final_theme, core_variables, final_main_fonts, final_mono_fonts
|
569 |
):
|
@@ -927,6 +926,10 @@ with gr.Blocks(theme=theme) as demo:
|
|
927 |
).then
|
928 |
)
|
929 |
|
|
|
|
|
|
|
|
|
930 |
for theme_box in (
|
931 |
text_sizes + spacing_sizes + radius_sizes + main_fonts + mono_fonts
|
932 |
):
|
|
|
102 |
load_theme_btn = gr.Button("Load Theme", elem_id="load_theme")
|
103 |
gr.Markdown(
|
104 |
"""
|
105 |
+
Load a custom theme. Just copy any theme name from [Theme Gallery](https://huggingface.co/spaces/gradio/theme-gallery)
|
106 |
+
"""
|
107 |
)
|
108 |
|
109 |
custom_theme_name = gr.Textbox(
|
|
|
506 |
)
|
507 |
|
508 |
def load_theme(theme_name, custom_theme: gr.themes.Base = None):
|
509 |
+
print("loading theme", theme_name, custom_theme.__dict__ if custom_theme else None)
|
510 |
if custom_theme:
|
511 |
theme = custom_theme
|
512 |
else:
|
513 |
theme = [theme for theme in themes if theme.__name__ == theme_name][0]
|
514 |
theme = theme()
|
515 |
+
|
516 |
parameters = inspect.signature(theme.__init__).parameters
|
517 |
primary_hue = parameters["primary_hue"].default
|
518 |
secondary_hue = parameters["secondary_hue"].default
|
|
|
557 |
)
|
558 |
|
559 |
def load_custom_theme(custom_theme_name):
|
560 |
+
print("loading custom theme", custom_theme_name)
|
561 |
theme = gr.Theme.from_hub(custom_theme_name)
|
562 |
+
print("loaded custom theme", theme.name)
|
563 |
return load_theme(theme.name, theme)
|
564 |
|
565 |
|
|
|
|
|
566 |
def generate_theme_code(
|
567 |
base_theme, final_theme, core_variables, final_main_fonts, final_mono_fonts
|
568 |
):
|
|
|
926 |
).then
|
927 |
)
|
928 |
|
929 |
+
attach_rerender(
|
930 |
+
load_custom_theme_btn.click(load_custom_theme, custom_theme_name, theme_inputs, show_api=False).then
|
931 |
+
)
|
932 |
+
|
933 |
for theme_box in (
|
934 |
text_sizes + spacing_sizes + radius_sizes + main_fonts + mono_fonts
|
935 |
):
|