Nischal Subedi
commited on
Commit
·
ea4e4a0
1
Parent(s):
ed1ba16
updated UI
Browse files
app.py
CHANGED
|
@@ -240,7 +240,7 @@ Answer:"""
|
|
| 240 |
# --- GRADIO INTERFACE (Complete Overhaul for Cohesion, Legibility, and Advanced Look) ---
|
| 241 |
def gradio_interface(self):
|
| 242 |
def query_interface_wrapper(api_key: str, query: str, state: str) -> str:
|
| 243 |
-
# Basic client-side validation for immediate feedback
|
| 244 |
if not api_key or not api_key.strip() or not api_key.startswith("sk-"):
|
| 245 |
return "<div class='error-message'><span class='error-icon'>⚠️</span>Please provide a valid OpenAI API key (starting with 'sk-'). <a href='https://platform.openai.com/api-keys' target='_blank'>Get one here</a>.</div>"
|
| 246 |
if not state or state == "Select a state..." or "Error" in state:
|
|
@@ -957,10 +957,9 @@ Answer:"""
|
|
| 957 |
}
|
| 958 |
.gradio-button span:focus { outline: none !important; }
|
| 959 |
|
| 960 |
-
/* MOST AGGRESSIVE "FALSE" REMOVAL - THIS SHOULD FINALLY KILL IT */
|
| 961 |
-
/* Targets ALL known problematic elements that might contain "false"
|
| 962 |
.gr-examples .gr-label,
|
| 963 |
-
.gr-examples .gr-examples-header, /* Standard header for examples */
|
| 964 |
.gr-examples button.gr-button-filter, /* The "☰" icon button */
|
| 965 |
.gr-examples .label-wrap, /* Common wrapper for labels */
|
| 966 |
.gr-examples div[data-testid*="label-text"], /* Div containing "false" text by data-testid */
|
|
@@ -969,10 +968,16 @@ Answer:"""
|
|
| 969 |
.gr-examples .gr-example-label, /* Specific class for example labels */
|
| 970 |
.gr-examples .gr-box.gr-component.gradio-example > div:first-child:has(> span[data-testid]), /* Target parent div of specific internal spans with data-testid */
|
| 971 |
.gr-examples .gr-box.gr-component.gradio-example > div:first-child > span, /* Direct span within example items, often containing "false" */
|
| 972 |
-
/* Targeting elements
|
| 973 |
-
.examples
|
| 974 |
-
.examples
|
| 975 |
-
.examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 976 |
{
|
| 977 |
display: none !important;
|
| 978 |
visibility: hidden !important; /* Double down on hiding */
|
|
@@ -1078,7 +1083,7 @@ Answer:"""
|
|
| 1078 |
gr.Markdown(
|
| 1079 |
"""
|
| 1080 |
<p>Navigate landlord-tenant laws with ease. This assistant provides detailed, state-specific answers grounded in legal authority.</p>
|
| 1081 |
-
<p><strong>Disclaimer:</strong> This tool
|
| 1082 |
"""
|
| 1083 |
)
|
| 1084 |
|
|
@@ -1156,7 +1161,6 @@ Answer:"""
|
|
| 1156 |
)
|
| 1157 |
logging.info("Completely new, cohesive, dynamic, and legible Gradio interface created with Legal Console theme.")
|
| 1158 |
return demo
|
| 1159 |
-
|
| 1160 |
# --- Main Execution Block (remains untouched from original logic) ---
|
| 1161 |
if __name__ == "__main__":
|
| 1162 |
logging.info("Starting Landlord-Tenant Rights Bot application...")
|
|
|
|
| 240 |
# --- GRADIO INTERFACE (Complete Overhaul for Cohesion, Legibility, and Advanced Look) ---
|
| 241 |
def gradio_interface(self):
|
| 242 |
def query_interface_wrapper(api_key: str, query: str, state: str) -> str:
|
| 243 |
+
# Basic client-client-side validation for immediate feedback
|
| 244 |
if not api_key or not api_key.strip() or not api_key.startswith("sk-"):
|
| 245 |
return "<div class='error-message'><span class='error-icon'>⚠️</span>Please provide a valid OpenAI API key (starting with 'sk-'). <a href='https://platform.openai.com/api-keys' target='_blank'>Get one here</a>.</div>"
|
| 246 |
if not state or state == "Select a state..." or "Error" in state:
|
|
|
|
| 957 |
}
|
| 958 |
.gradio-button span:focus { outline: none !important; }
|
| 959 |
|
| 960 |
+
/* MOST AGGRESSIVE "FALSE" & FILTER ICON REMOVAL - THIS SHOULD FINALLY KILL IT */
|
| 961 |
+
/* Targets ALL known problematic elements that might contain "false", the filter menu icon, or accordion toggle */
|
| 962 |
.gr-examples .gr-label,
|
|
|
|
| 963 |
.gr-examples button.gr-button-filter, /* The "☰" icon button */
|
| 964 |
.gr-examples .label-wrap, /* Common wrapper for labels */
|
| 965 |
.gr-examples div[data-testid*="label-text"], /* Div containing "false" text by data-testid */
|
|
|
|
| 968 |
.gr-examples .gr-example-label, /* Specific class for example labels */
|
| 969 |
.gr-examples .gr-box.gr-component.gradio-example > div:first-child:has(> span[data-testid]), /* Target parent div of specific internal spans with data-testid */
|
| 970 |
.gr-examples .gr-box.gr-component.gradio-example > div:first-child > span, /* Direct span within example items, often containing "false" */
|
| 971 |
+
/* NEW: Targeting Accordion-related elements if Examples acts as an Accordion internally */
|
| 972 |
+
.gr-examples .gr-accordion-header,
|
| 973 |
+
.gr-examples .gr-accordion-title,
|
| 974 |
+
.gr-examples .gr-accordion-toggle-icon,
|
| 975 |
+
.gr-examples .gr-accordion-header button,
|
| 976 |
+
.gr-examples .gr-button.gr-button-filter, /* More general button target for filter */
|
| 977 |
+
.gr-examples .gr-button.gr-button-primary.gr-button-filter, /* Specific primary filter button target */
|
| 978 |
+
/* NEW AND MORE AGGRESSIVE: Target the entire header of gr.Examples and its direct children */
|
| 979 |
+
.gr-examples .gr-examples-header, /* The main header container for examples */
|
| 980 |
+
.gr-examples .gr-examples-header > * /* ALL direct children within that header */
|
| 981 |
{
|
| 982 |
display: none !important;
|
| 983 |
visibility: hidden !important; /* Double down on hiding */
|
|
|
|
| 1083 |
gr.Markdown(
|
| 1084 |
"""
|
| 1085 |
<p>Navigate landlord-tenant laws with ease. This assistant provides detailed, state-specific answers grounded in legal authority.</p>
|
| 1086 |
+
<p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. For specific legal guidance, always consult a licensed attorney in your jurisdiction.</p>
|
| 1087 |
"""
|
| 1088 |
)
|
| 1089 |
|
|
|
|
| 1161 |
)
|
| 1162 |
logging.info("Completely new, cohesive, dynamic, and legible Gradio interface created with Legal Console theme.")
|
| 1163 |
return demo
|
|
|
|
| 1164 |
# --- Main Execution Block (remains untouched from original logic) ---
|
| 1165 |
if __name__ == "__main__":
|
| 1166 |
logging.info("Starting Landlord-Tenant Rights Bot application...")
|