Cachoups commited on
Commit
035782a
·
verified ·
1 Parent(s): 3784236

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -4
app.py CHANGED
@@ -301,13 +301,36 @@ stored_paragraphs_2 = []
301
  stored_df1 = []
302
  stored_df2 = []
303
 
 
 
304
  def toggle_dark_mode():
305
- # This can be used if you want to manage state in Python,
306
- # but since we are using JavaScript for dark mode,
307
- # we don't need to define any function here.
308
- return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
 
310
  with gr.Blocks(theme='gradio/soft') as demo:
 
 
 
 
311
  with gr.Tab("Methodology"):
312
  gr.Markdown("""
313
  ## Macro-economy Adverse Scenario Comparison from EBA Reports
 
301
  stored_df1 = []
302
  stored_df2 = []
303
 
304
+ current_theme = {"dark": False}
305
+
306
  def toggle_dark_mode():
307
+ current_theme["dark"] = not current_theme["dark"]
308
+ if current_theme["dark"]:
309
+ return gr.update(css="""
310
+ body {
311
+ background-color: #333;
312
+ color: white;
313
+ }
314
+ .gradio-container {
315
+ background-color: #444;
316
+ }
317
+ """)
318
+ else:
319
+ return gr.update(css="""
320
+ body {
321
+ background-color: white;
322
+ color: black;
323
+ }
324
+ .gradio-container {
325
+ background-color: #f0f0f0;
326
+ }
327
+ """)
328
 
329
  with gr.Blocks(theme='gradio/soft') as demo:
330
+ with gr.Row():
331
+ toggle_dark = gr.Button(value="Toggle Dark Mode")
332
+
333
+ toggle_dark.click(fn=toggle_dark_mode)
334
  with gr.Tab("Methodology"):
335
  gr.Markdown("""
336
  ## Macro-economy Adverse Scenario Comparison from EBA Reports