FAW-AI-APP / style_tab.py
JarvisLabs's picture
Upload 12 files
34492bf verified
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