BICORP commited on
Commit
a00ae4c
·
verified ·
1 Parent(s): e4f6161

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -76,6 +76,10 @@ light_css = """
76
  #send-button:hover {
77
  opacity: 0.7;
78
  }
 
 
 
 
79
  """
80
 
81
  # Dark mode CSS
@@ -105,6 +109,10 @@ dark_css = """
105
  }
106
  """
107
 
 
 
 
 
108
  # Create Gradio interface
109
  def create_interface():
110
  with gr.Blocks() as demo:
@@ -119,7 +127,7 @@ def create_interface():
119
  send_btn = gr.Button("➤", elem_id="send-button")
120
 
121
  # Settings section
122
- with gr.Accordion("⚙️ Settings", open=False):
123
  model = gr.Dropdown(choices=["Lake 1 Base"], label="Model", value="Lake 1 Base")
124
  preset = gr.Dropdown(choices=["Fast", "Normal", "Quality", "Unreal Performance"], label="Preset", value="Fast")
125
  dark_mode = gr.Checkbox(label="Enable Dark Mode", value=False)
@@ -127,8 +135,8 @@ def create_interface():
127
  # Button click event
128
  send_btn.click(call_api, inputs=[message, model, preset], outputs=chatbox)
129
 
130
- # Toggle dark mode
131
- dark_mode.change(lambda x: demo.css = dark_css if x else light_css, inputs=[dark_mode])
132
 
133
  return demo
134
 
 
76
  #send-button:hover {
77
  opacity: 0.7;
78
  }
79
+
80
+ #settings-container {
81
+ margin-top: 20px;
82
+ }
83
  """
84
 
85
  # Dark mode CSS
 
109
  }
110
  """
111
 
112
+ # Function to toggle dark mode
113
+ def toggle_dark_mode(is_dark):
114
+ return dark_css if is_dark else light_css
115
+
116
  # Create Gradio interface
117
  def create_interface():
118
  with gr.Blocks() as demo:
 
127
  send_btn = gr.Button("➤", elem_id="send-button")
128
 
129
  # Settings section
130
+ with gr.Accordion("⚙️ Settings", open=False, elem_id="settings-container"):
131
  model = gr.Dropdown(choices=["Lake 1 Base"], label="Model", value="Lake 1 Base")
132
  preset = gr.Dropdown(choices=["Fast", "Normal", "Quality", "Unreal Performance"], label="Preset", value="Fast")
133
  dark_mode = gr.Checkbox(label="Enable Dark Mode", value=False)
 
135
  # Button click event
136
  send_btn.click(call_api, inputs=[message, model, preset], outputs=chatbox)
137
 
138
+ # Change CSS based on dark mode toggle
139
+ dark_mode.change(lambda x: demo.css.update(toggle_dark_mode(x)), inputs=[dark_mode])
140
 
141
  return demo
142