Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -271,30 +271,20 @@ with gr.Blocks() as app:
|
|
| 271 |
|
| 272 |
toggle_dark = gr.Button(value="Toggle Dark", scale=1)
|
| 273 |
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
() => {{
|
| 278 |
const themeElem = document.createElement('link');
|
| 279 |
themeElem.rel = 'stylesheet';
|
| 280 |
themeElem.href = '/themes/' + theme + '.css'; // Path to the theme CSS files
|
| 281 |
document.head.appendChild(themeElem);
|
| 282 |
}}
|
| 283 |
-
""",
|
| 284 |
-
inputs=theme_dropdown,
|
| 285 |
-
outputs=[]
|
| 286 |
-
)
|
| 287 |
-
|
| 288 |
-
toggle_dark.click(
|
| 289 |
-
None,
|
| 290 |
-
None,
|
| 291 |
-
None,
|
| 292 |
-
_js="""
|
| 293 |
-
() => {
|
| 294 |
-
document.body.classList.toggle('dark');
|
| 295 |
-
}
|
| 296 |
"""
|
| 297 |
-
|
|
|
|
|
|
|
|
|
|
| 298 |
|
| 299 |
with gr.Tab("Well-Being Chatbot"):
|
| 300 |
with gr.Row():
|
|
|
|
| 271 |
|
| 272 |
toggle_dark = gr.Button(value="Toggle Dark", scale=1)
|
| 273 |
|
| 274 |
+
def switch_theme(theme):
|
| 275 |
+
"""Switch CSS theme based on dropdown selection."""
|
| 276 |
+
return f"""
|
| 277 |
() => {{
|
| 278 |
const themeElem = document.createElement('link');
|
| 279 |
themeElem.rel = 'stylesheet';
|
| 280 |
themeElem.href = '/themes/' + theme + '.css'; // Path to the theme CSS files
|
| 281 |
document.head.appendChild(themeElem);
|
| 282 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
"""
|
| 284 |
+
|
| 285 |
+
theme_dropdown.change(switch_theme, inputs=theme_dropdown, outputs=[])
|
| 286 |
+
|
| 287 |
+
toggle_dark.click(lambda: None, None, None) # Just a placeholder for a dark mode operation
|
| 288 |
|
| 289 |
with gr.Tab("Well-Being Chatbot"):
|
| 290 |
with gr.Row():
|