DreamStream-1 commited on
Commit
b0e9702
·
verified ·
1 Parent(s): f2d2a15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -21
app.py CHANGED
@@ -258,33 +258,25 @@ def predict_disease(symptoms):
258
  return "\n".join(markdown_output)
259
 
260
  # Gradio Application Interface
261
- with gr.Blocks() as app:
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');
273
- themeElem.rel = 'stylesheet';
274
- themeElem.href = '/themes/' + theme + '.css'; // Path to the theme CSS files
275
- document.head.appendChild(themeElem);
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():
 
258
  return "\n".join(markdown_output)
259
 
260
  # Gradio Application Interface
261
+ with gr.Blocks(theme='shivi/calm_seafoam') as app: # Set theme here
262
  gr.HTML("<h1>🌟 Well-Being Companion</h1>")
263
 
264
  # Theme Dropdown
265
+ themes = [
266
+ "calm_seafoam",
267
+ "Ranko_test"
268
+ ]
269
+
270
+ theme_dropdown = gr.Dropdown(choices=themes, label="Select Theme")
271
+
272
+ # Button to toggle dark mode
 
 
 
 
 
 
 
 
273
  toggle_dark = gr.Button(value="Toggle Dark", scale=1)
274
 
275
+ # Function to switch to dark mode
276
+ def toggle_dark_mode(dark_mode):
277
+ return "dark" if dark_mode == "light" else "light"
278
 
279
+ toggle_dark.click(toggle_dark_mode, inputs=None, outputs=None) # Update this as you wish
280
 
281
  with gr.Tab("Well-Being Chatbot"):
282
  with gr.Row():