starboywilliam commited on
Commit
a2c6fde
·
verified ·
1 Parent(s): b47669f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -14
app.py CHANGED
@@ -32,27 +32,16 @@ def predict_salary(age, education_num, sex, capital_gain, capital_loss, hours_pe
32
 
33
  return label, confidence, fig
34
 
35
- toggle_theme = gr.State(value="dark")
36
-
37
- with gr.Blocks(css="""
38
  body { background-color: #0a0a23; color: white; }
39
  .gr-box { background-color: #1a1a3d !important; border-radius: 12px; padding: 20px; }
40
  h1, h3, p { color: white; text-align: center; font-family: 'Segoe UI', sans-serif; }
41
  .gr-button { background-color: #1db954 !important; color: white !important; border-radius: 10px; font-size: 1.1em; }
42
  .gr-radio .gr-form { display: flex; justify-content: center !important; }
43
  """
44
- ) as demo:
45
-
46
- def switch_theme(theme_choice):
47
- if theme_choice == "dark":
48
- return gr.themes.Base().set(body_background="#0a0a23", body_text_color="white"), "dark"
49
- else:
50
- return gr.themes.Default(), "light"
51
 
52
- with gr.Row():
53
- theme_toggle = gr.Radio(["dark", "light"], value="dark", label="Theme", interactive=True)
54
-
55
- theme_toggle.change(switch_theme, inputs=theme_toggle, outputs=[demo.theme, toggle_theme])
56
 
57
  gr.Markdown("""
58
  <div style='max-width: 700px; margin: 0 auto;'>
@@ -99,3 +88,4 @@ with gr.Blocks(css="""
99
  demo.launch()
100
 
101
 
 
 
32
 
33
  return label, confidence, fig
34
 
35
+ # Custom CSS for styling
36
+ dark_css = """
 
37
  body { background-color: #0a0a23; color: white; }
38
  .gr-box { background-color: #1a1a3d !important; border-radius: 12px; padding: 20px; }
39
  h1, h3, p { color: white; text-align: center; font-family: 'Segoe UI', sans-serif; }
40
  .gr-button { background-color: #1db954 !important; color: white !important; border-radius: 10px; font-size: 1.1em; }
41
  .gr-radio .gr-form { display: flex; justify-content: center !important; }
42
  """
 
 
 
 
 
 
 
43
 
44
+ with gr.Blocks(css=dark_css) as demo:
 
 
 
45
 
46
  gr.Markdown("""
47
  <div style='max-width: 700px; margin: 0 auto;'>
 
88
  demo.launch()
89
 
90
 
91
+