DreamStream-1 commited on
Commit
a6f0fe8
·
verified ·
1 Parent(s): 40c665e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -17
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
- # Theme changing logic
275
- theme_dropdown.change(
276
- lambda theme: 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
- 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():