Nischal Subedi
commited on
Commit
·
792a7aa
1
Parent(s):
6cd408d
UI update
Browse files
app.py
CHANGED
|
@@ -259,8 +259,10 @@ Answer:"""
|
|
| 259 |
formatted_response = f"<div class='response-title'>Response for {state}</div><div class='response-content'>{answer}</div>"
|
| 260 |
return f"<div class='output-box'>{formatted_response}</div>"
|
| 261 |
|
| 262 |
-
def toggle_theme(
|
| 263 |
-
|
|
|
|
|
|
|
| 264 |
|
| 265 |
try:
|
| 266 |
available_states = self.get_states()
|
|
@@ -560,9 +562,7 @@ Answer:"""
|
|
| 560 |
with gr.Row():
|
| 561 |
with gr.Column(scale=1):
|
| 562 |
gr.Markdown("<div class='header'><h1>Landlord-Tenant Rights Assistant</h1></div>")
|
| 563 |
-
|
| 564 |
-
theme_dark = gr.HTML(visible=False, value="<div class='theme-toggle'><button onclick='document.body.classList.add(\"dark-mode\");'>Dark Mode</button></div>")
|
| 565 |
-
gr.Button("Toggle Dark Mode", lambda: [gr.update(visible=True), gr.update(visible=False)], outputs=[theme_dark, theme_light])
|
| 566 |
|
| 567 |
with gr.Column(elem_classes="container"):
|
| 568 |
with gr.Column():
|
|
@@ -587,6 +587,11 @@ Answer:"""
|
|
| 587 |
with gr.Column():
|
| 588 |
gr.Markdown("<div class='footer'><p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. Consult a licensed attorney for specific guidance. Developed by Nischal Subedi.</p></div>")
|
| 589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
submit_button.click(
|
| 591 |
fn=query_interface_wrapper,
|
| 592 |
inputs=[api_key_input, query_input, state_input],
|
|
|
|
| 259 |
formatted_response = f"<div class='response-title'>Response for {state}</div><div class='response-content'>{answer}</div>"
|
| 260 |
return f"<div class='output-box'>{formatted_response}</div>"
|
| 261 |
|
| 262 |
+
def toggle_theme():
|
| 263 |
+
is_dark = "dark-mode" in document.body.className
|
| 264 |
+
document.body.className = "dark-mode" if not is_dark else ""
|
| 265 |
+
return gr.update(visible=not is_dark), gr.update(visible=is_dark)
|
| 266 |
|
| 267 |
try:
|
| 268 |
available_states = self.get_states()
|
|
|
|
| 562 |
with gr.Row():
|
| 563 |
with gr.Column(scale=1):
|
| 564 |
gr.Markdown("<div class='header'><h1>Landlord-Tenant Rights Assistant</h1></div>")
|
| 565 |
+
theme_toggle_btn = gr.Button("Toggle Dark Mode", elem_classes="theme-toggle")
|
|
|
|
|
|
|
| 566 |
|
| 567 |
with gr.Column(elem_classes="container"):
|
| 568 |
with gr.Column():
|
|
|
|
| 587 |
with gr.Column():
|
| 588 |
gr.Markdown("<div class='footer'><p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. Consult a licensed attorney for specific guidance. Developed by Nischal Subedi.</p></div>")
|
| 589 |
|
| 590 |
+
theme_toggle_btn.click(
|
| 591 |
+
fn=toggle_theme,
|
| 592 |
+
outputs=[]
|
| 593 |
+
)
|
| 594 |
+
|
| 595 |
submit_button.click(
|
| 596 |
fn=query_interface_wrapper,
|
| 597 |
inputs=[api_key_input, query_input, state_input],
|