Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -262,17 +262,11 @@ with gr.Blocks() as app:
|
|
262 |
gr.HTML("<h1>🌟 Well-Being Companion</h1>")
|
263 |
|
264 |
# Theme Dropdown
|
265 |
-
|
266 |
-
|
267 |
-
"Ranko_test"
|
268 |
-
]
|
269 |
-
|
270 |
-
theme_dropdown = gr.Dropdown(choices=themes, label="Select Theme")
|
271 |
-
|
272 |
-
toggle_dark = gr.Button(value="Toggle Dark", scale=1)
|
273 |
|
274 |
-
def
|
275 |
-
"""
|
276 |
return f"""
|
277 |
() => {{
|
278 |
const themeElem = document.createElement('link');
|
@@ -282,9 +276,15 @@ with gr.Blocks() as app:
|
|
282 |
}}
|
283 |
"""
|
284 |
|
285 |
-
theme_dropdown.change(
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
|
287 |
-
toggle_dark.click(
|
288 |
|
289 |
with gr.Tab("Well-Being Chatbot"):
|
290 |
with gr.Row():
|
|
|
262 |
gr.HTML("<h1>🌟 Well-Being Companion</h1>")
|
263 |
|
264 |
# Theme Dropdown
|
265 |
+
theme_dropdown = gr.Dropdown(choices=["calm_seafoam", "Ranko_test"], label="Select Theme")
|
266 |
+
theme_state = gr.State("calm_seafoam") # Default Theme
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
+
def update_theme(theme):
|
269 |
+
"""Update the theme based on user selection."""
|
270 |
return f"""
|
271 |
() => {{
|
272 |
const themeElem = document.createElement('link');
|
|
|
276 |
}}
|
277 |
"""
|
278 |
|
279 |
+
theme_dropdown.change(update_theme, inputs=theme_dropdown, outputs=[])
|
280 |
+
|
281 |
+
toggle_dark = gr.Button(value="Toggle Dark", scale=1)
|
282 |
+
|
283 |
+
# Moving dark mode functionality to a Python function
|
284 |
+
def toggle_dark_mode():
|
285 |
+
return "dark" if "dark" not in app.state else ""
|
286 |
|
287 |
+
toggle_dark.click(toggle_dark_mode, None, theme_state)
|
288 |
|
289 |
with gr.Tab("Well-Being Chatbot"):
|
290 |
with gr.Row():
|