Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def create_style_tab(demo): | |
| with gr.TabItem("Style Customization"): | |
| theme_dropdown = gr.Dropdown(choices=["Default", "Glass", "Monochrome", "Soft"], label="Choose a Theme") | |
| custom_css = gr.Textbox(label="Custom CSS", placeholder="Enter custom CSS here...") | |
| apply_button = gr.Button("Apply Style") | |
| def apply_style(theme, css): | |
| if theme == "Default": | |
| demo.theme = gr.themes.Default() | |
| elif theme == "Glass": | |
| demo.theme = gr.themes.Glass() | |
| elif theme == "Monochrome": | |
| demo.theme = gr.themes.Monochrome() | |
| elif theme == "Soft": | |
| demo.theme = gr.themes.Soft() | |
| if css: | |
| demo.css = css | |
| apply_button.click(apply_style, inputs=[theme_dropdown, custom_css], outputs=[]) | |
| return demo |