Nischal Subedi
commited on
Commit
·
4ddd3a0
1
Parent(s):
791e26c
UI update
Browse files
app.py
CHANGED
|
@@ -249,11 +249,11 @@ Answer:"""
|
|
| 249 |
def query_interface_wrapper(api_key: str, query: str, state: str) -> str:
|
| 250 |
# Basic client-side validation for immediate feedback (redundant but good UX)
|
| 251 |
if not api_key or not api_key.strip() or not api_key.startswith("sk-"):
|
| 252 |
-
return "<div class='error-message'><span class='error-icon'
|
| 253 |
if not state or state is None:
|
| 254 |
-
return "<div class='error-message'><span class='error-icon'
|
| 255 |
if not query or not query.strip():
|
| 256 |
-
return "<div class='error-message'><span class='error-icon'
|
| 257 |
|
| 258 |
# Call the core processing logic
|
| 259 |
result = self.process_query(query=query, state=state, openai_api_key=api_key)
|
|
@@ -293,83 +293,66 @@ Answer:"""
|
|
| 293 |
example_queries.append(["What basic rights do tenants have?", "California"])
|
| 294 |
|
| 295 |
custom_css = """
|
| 296 |
-
/* Import
|
| 297 |
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700
|
| 298 |
|
| 299 |
-
/* Root variables for the light
|
| 300 |
:root {
|
| 301 |
-
--primary-color: #FF8C00;
|
| 302 |
-
--primary-hover: #E07B00;
|
| 303 |
-
--background-
|
| 304 |
-
--background-
|
| 305 |
-
--text-primary: #
|
| 306 |
-
--text-secondary: #
|
| 307 |
-
--border-color:
|
| 308 |
-
--border-focus: #FF8C00;
|
| 309 |
-
--shadow-sm: 0
|
| 310 |
-
--shadow-md: 0 4px
|
| 311 |
-
--
|
| 312 |
-
--error-
|
| 313 |
-
--error-
|
| 314 |
-
--
|
| 315 |
-
|
| 316 |
-
--gradient-start: #FFDAB3; /* Lighter orange to match the theme */
|
| 317 |
-
--gradient-end: #FFE8CC; /* Matches the background for a cohesive look */
|
| 318 |
}
|
| 319 |
|
| 320 |
body, html {
|
| 321 |
-
background-color: var(--background-
|
| 322 |
color: var(--text-primary) !important;
|
| 323 |
-
|
|
|
|
|
|
|
| 324 |
}
|
| 325 |
|
| 326 |
.gradio-container {
|
| 327 |
-
max-width:
|
| 328 |
-
margin:
|
| 329 |
-
padding:
|
| 330 |
-
|
| 331 |
-
background-color: var(--background-secondary) !important;
|
| 332 |
box-shadow: none !important;
|
| 333 |
color: var(--text-primary) !important;
|
| 334 |
}
|
| 335 |
|
| 336 |
-
.main-dashboard-container
|
| 337 |
-
|
|
|
|
|
|
|
| 338 |
}
|
| 339 |
|
| 340 |
.app-header-wrapper {
|
| 341 |
background: linear-gradient(145deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
|
| 342 |
-
border:
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
margin-bottom: 1.5rem !important;
|
| 346 |
box-shadow: var(--shadow-md) !important;
|
| 347 |
-
position: relative;
|
| 348 |
-
overflow: hidden;
|
| 349 |
text-align: center !important;
|
| 350 |
color: var(--text-primary) !important;
|
| 351 |
}
|
| 352 |
|
| 353 |
-
.app-header-wrapper::before {
|
| 354 |
-
content: '';
|
| 355 |
-
position: absolute;
|
| 356 |
-
top: 0;
|
| 357 |
-
left: 0;
|
| 358 |
-
width: 100%;
|
| 359 |
-
height: 100%;
|
| 360 |
-
background: radial-gradient(circle at top left, rgba(255,140,0,0.3) 0%, transparent 60%), radial-gradient(circle at bottom right, rgba(255,140,0,0.3) 0%, transparent 60%);
|
| 361 |
-
z-index: 0;
|
| 362 |
-
opacity: 0.8;
|
| 363 |
-
pointer-events: none;
|
| 364 |
-
}
|
| 365 |
-
|
| 366 |
.app-header-logo {
|
| 367 |
-
font-size:
|
| 368 |
-
margin-bottom:
|
| 369 |
display: block !important;
|
| 370 |
color: var(--primary-color) !important;
|
| 371 |
-
position: relative;
|
| 372 |
-
z-index: 1;
|
| 373 |
animation: float-icon 3s ease-in-out infinite alternate;
|
| 374 |
}
|
| 375 |
|
|
@@ -381,49 +364,34 @@ Answer:"""
|
|
| 381 |
|
| 382 |
.app-header-title {
|
| 383 |
font-family: 'Poppins', sans-serif !important;
|
| 384 |
-
font-size:
|
| 385 |
-
font-weight:
|
| 386 |
color: var(--text-primary) !important;
|
| 387 |
-
margin: 0 0 0.
|
| 388 |
-
line-height: 1.
|
| 389 |
-
letter-spacing: -0.03em !important;
|
| 390 |
-
position: relative;
|
| 391 |
-
z-index: 1;
|
| 392 |
-
display: inline-block;
|
| 393 |
-
max-width: 100%;
|
| 394 |
}
|
| 395 |
|
| 396 |
.app-header-tagline {
|
| 397 |
-
font-size: 1.
|
| 398 |
color: var(--text-secondary) !important;
|
| 399 |
font-weight: 400 !important;
|
| 400 |
margin: 0 !important;
|
| 401 |
-
max-width:
|
| 402 |
-
|
| 403 |
-
position: relative;
|
| 404 |
-
z-index: 1;
|
| 405 |
-
}
|
| 406 |
-
|
| 407 |
-
.main-dashboard-container {
|
| 408 |
-
display: flex !important;
|
| 409 |
-
flex-direction: column !important;
|
| 410 |
-
gap: 1.25rem !important;
|
| 411 |
}
|
| 412 |
|
| 413 |
.dashboard-card-section {
|
| 414 |
-
background-color: var(--background-
|
| 415 |
-
border: 2px solid var(--border-color) !important;
|
| 416 |
border-radius: 12px !important;
|
| 417 |
padding: 0 !important;
|
| 418 |
box-shadow: var(--shadow-sm) !important;
|
| 419 |
-
transition:
|
| 420 |
-
cursor: default;
|
| 421 |
color: var(--text-primary) !important;
|
| 422 |
}
|
| 423 |
|
| 424 |
.dashboard-card-section:hover {
|
| 425 |
box-shadow: var(--shadow-md) !important;
|
| 426 |
-
transform: translateY(-
|
| 427 |
}
|
| 428 |
|
| 429 |
.full-width-center {
|
|
@@ -437,9 +405,9 @@ Answer:"""
|
|
| 437 |
|
| 438 |
.section-title-gradient-bar {
|
| 439 |
background: linear-gradient(145deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
|
| 440 |
-
padding:
|
| 441 |
-
border-top-left-radius:
|
| 442 |
-
border-top-right-radius:
|
| 443 |
margin-bottom: 0 !important;
|
| 444 |
text-align: center !important;
|
| 445 |
box-sizing: border-box;
|
|
@@ -449,39 +417,34 @@ Answer:"""
|
|
| 449 |
|
| 450 |
.section-title {
|
| 451 |
font-family: 'Poppins', sans-serif !important;
|
| 452 |
-
font-size: 1.
|
| 453 |
-
font-weight:
|
| 454 |
color: var(--text-primary) !important;
|
| 455 |
margin: 0 !important;
|
| 456 |
-
|
| 457 |
-
border-bottom: 2px solid var(--border-color) !important;
|
| 458 |
-
line-height: 1.1 !important;
|
| 459 |
-
display: inline-block !important;
|
| 460 |
-
text-align: center !important;
|
| 461 |
-
letter-spacing: -0.01em !important;
|
| 462 |
}
|
| 463 |
|
| 464 |
.dashboard-card-content-area {
|
| 465 |
-
padding:
|
| 466 |
-
background-color: var(--background-
|
|
|
|
|
|
|
| 467 |
box-sizing: border-box;
|
| 468 |
width: 100%;
|
| 469 |
color: var(--text-primary) !important;
|
| 470 |
}
|
| 471 |
|
| 472 |
.dashboard-card-section p {
|
| 473 |
-
line-height: 1.
|
| 474 |
color: var(--text-primary) !important;
|
| 475 |
font-size: 1rem !important;
|
| 476 |
text-align: left !important;
|
| 477 |
-
background-color: transparent !important;
|
| 478 |
margin: 0 !important;
|
| 479 |
padding: 0 !important;
|
| 480 |
-
white-space: normal !important;
|
| 481 |
}
|
| 482 |
|
| 483 |
.dashboard-card-section strong, .dashboard-card-section b {
|
| 484 |
-
font-weight:
|
| 485 |
color: var(--primary-color) !important;
|
| 486 |
}
|
| 487 |
|
|
@@ -499,35 +462,32 @@ Answer:"""
|
|
| 499 |
.gradio-textbox input,
|
| 500 |
.gradio-radio label,
|
| 501 |
.placeholder {
|
| 502 |
-
background-color:
|
| 503 |
color: var(--text-primary) !important;
|
|
|
|
|
|
|
| 504 |
}
|
| 505 |
|
| 506 |
.gradio-textbox {
|
| 507 |
-
margin-bottom:
|
| 508 |
}
|
| 509 |
|
| 510 |
.gradio-textbox textarea,
|
| 511 |
.gradio-textbox input {
|
| 512 |
-
border:
|
| 513 |
border-radius: 8px !important;
|
| 514 |
-
padding: 0.
|
| 515 |
-
font-size:
|
| 516 |
font-family: 'Inter', sans-serif !important;
|
| 517 |
color: var(--text-primary) !important;
|
| 518 |
transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
|
| 519 |
-
box-shadow: var(--shadow-sm) !important;
|
| 520 |
-
}
|
| 521 |
-
|
| 522 |
-
.gradio-textbox .scroll-hide {
|
| 523 |
-
background-color: var(--background-primary) !important;
|
| 524 |
}
|
| 525 |
|
| 526 |
.gradio-textbox textarea:focus,
|
| 527 |
.gradio-textbox input:focus {
|
| 528 |
outline: none !important;
|
| 529 |
border-color: var(--border-focus) !important;
|
| 530 |
-
box-shadow: 0 0 0
|
| 531 |
}
|
| 532 |
|
| 533 |
.gradio-radio {
|
|
@@ -544,45 +504,37 @@ Answer:"""
|
|
| 544 |
justify-content: center !important;
|
| 545 |
align-items: center !important;
|
| 546 |
padding: 0.75rem 1rem !important;
|
| 547 |
-
border:
|
| 548 |
border-radius: 8px !important;
|
| 549 |
color: var(--text-primary) !important;
|
| 550 |
font-weight: 500 !important;
|
| 551 |
cursor: pointer !important;
|
| 552 |
transition: all 0.2s ease-out !important;
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
width: 100 !important;
|
| 556 |
box-sizing: border-box !important;
|
| 557 |
}
|
| 558 |
|
| 559 |
.gradio-radio label span.text-lg {
|
| 560 |
-
font-weight:
|
| 561 |
color: var(--text-primary) !important;
|
| 562 |
-
font-size:
|
| 563 |
}
|
| 564 |
|
| 565 |
.gradio-radio label:hover {
|
| 566 |
-
background-color: var(--background-secondary) !important;
|
| 567 |
border-color: var(--primary-color) !important;
|
| 568 |
box-shadow: var(--shadow-md) !important;
|
| 569 |
-
transform: translateY(-2px) !important;
|
| 570 |
}
|
| 571 |
|
| 572 |
.gradio-radio input[type="radio"]:checked + label {
|
| 573 |
background-color: var(--primary-color) !important;
|
| 574 |
-
color:
|
| 575 |
-
border-color: var(--primary-
|
| 576 |
box-shadow: var(--shadow-md) !important;
|
| 577 |
-
transform: translateY(-1px) !important;
|
| 578 |
}
|
| 579 |
|
| 580 |
.gradio-radio input[type="radio"]:checked + label span.text-lg {
|
| 581 |
-
color:
|
| 582 |
-
}
|
| 583 |
-
|
| 584 |
-
.gradio-radio .gr-form {
|
| 585 |
-
padding: 0 !important;
|
| 586 |
}
|
| 587 |
|
| 588 |
.gradio-textbox label,
|
|
@@ -590,7 +542,7 @@ Answer:"""
|
|
| 590 |
font-weight: 600 !important;
|
| 591 |
color: var(--text-primary) !important;
|
| 592 |
font-size: 1rem !important;
|
| 593 |
-
margin-bottom: 0.
|
| 594 |
display: block !important;
|
| 595 |
text-align: left !important;
|
| 596 |
}
|
|
@@ -598,7 +550,7 @@ Answer:"""
|
|
| 598 |
.gr-prose {
|
| 599 |
font-size: 0.9rem !important;
|
| 600 |
color: var(--text-secondary) !important;
|
| 601 |
-
margin-top: 0.
|
| 602 |
text-align: left !important;
|
| 603 |
background-color: transparent !important;
|
| 604 |
}
|
|
@@ -606,8 +558,8 @@ Answer:"""
|
|
| 606 |
.input-column {
|
| 607 |
display: flex !important;
|
| 608 |
flex-direction: column !important;
|
| 609 |
-
gap: 1.
|
| 610 |
-
margin-bottom:
|
| 611 |
}
|
| 612 |
|
| 613 |
.input-field {
|
|
@@ -623,67 +575,67 @@ Answer:"""
|
|
| 623 |
}
|
| 624 |
|
| 625 |
.gradio-button {
|
| 626 |
-
padding: 0.
|
| 627 |
-
border-radius:
|
| 628 |
font-weight: 600 !important;
|
| 629 |
font-size: 1rem !important;
|
|
|
|
| 630 |
transition: all 0.2s ease-out !important;
|
| 631 |
cursor: pointer !important;
|
| 632 |
-
border:
|
| 633 |
text-align: center !important;
|
| 634 |
-
color: var(--text-primary) !important;
|
| 635 |
}
|
| 636 |
|
| 637 |
.gr-button-primary {
|
| 638 |
background-color: var(--primary-color) !important;
|
| 639 |
-
color:
|
| 640 |
box-shadow: var(--shadow-sm) !important;
|
| 641 |
}
|
| 642 |
|
| 643 |
.gr-button-primary:hover {
|
| 644 |
background-color: var(--primary-hover) !important;
|
| 645 |
box-shadow: var(--shadow-md) !important;
|
| 646 |
-
transform: translateY(-
|
| 647 |
}
|
| 648 |
|
| 649 |
.gr-button-primary:active {
|
| 650 |
-
transform: translateY(
|
| 651 |
-
box-shadow:
|
| 652 |
}
|
| 653 |
|
| 654 |
.gr-button-secondary {
|
| 655 |
-
background-color:
|
| 656 |
color: var(--text-primary) !important;
|
| 657 |
-
border
|
| 658 |
}
|
| 659 |
|
| 660 |
.gr-button-secondary:hover {
|
| 661 |
-
background-color:
|
| 662 |
border-color: var(--primary-color) !important;
|
| 663 |
-
transform: translateY(-
|
| 664 |
}
|
| 665 |
|
| 666 |
.gr-button-secondary:active {
|
| 667 |
-
transform: translateY(
|
| 668 |
box-shadow: none !important;
|
| 669 |
}
|
| 670 |
|
| 671 |
.output-content-wrapper {
|
| 672 |
-
background-color:
|
| 673 |
-
border: 2px solid var(--border-color) !important;
|
| 674 |
border-radius: 8px !important;
|
| 675 |
padding: 1.5rem !important;
|
| 676 |
-
min-height:
|
| 677 |
color: var(--text-primary) !important;
|
| 678 |
display: flex;
|
| 679 |
flex-direction: column;
|
| 680 |
justify-content: center;
|
| 681 |
align-items: center;
|
|
|
|
| 682 |
}
|
| 683 |
|
| 684 |
.animated-output-content {
|
| 685 |
opacity: 0;
|
| 686 |
-
animation: fadeInAndSlideUp 0.
|
| 687 |
width: 100%;
|
| 688 |
white-space: pre-wrap;
|
| 689 |
overflow-wrap: break-word;
|
|
@@ -693,46 +645,45 @@ Answer:"""
|
|
| 693 |
}
|
| 694 |
|
| 695 |
@keyframes fadeInAndSlideUp {
|
| 696 |
-
from { opacity: 0; transform: translateY(
|
| 697 |
to { opacity: 1; transform: translateY(0); }
|
| 698 |
}
|
| 699 |
|
| 700 |
.response-header {
|
| 701 |
-
font-size: 1.
|
| 702 |
-
font-weight:
|
| 703 |
color: var(--primary-color) !important;
|
| 704 |
margin-bottom: 0.75rem !important;
|
| 705 |
display: flex !important;
|
| 706 |
align-items: center !important;
|
| 707 |
-
gap: 0.
|
| 708 |
text-align: left !important;
|
| 709 |
width: 100%;
|
| 710 |
-
justify-content: flex-start;
|
| 711 |
}
|
| 712 |
|
| 713 |
.response-icon {
|
| 714 |
-
font-size: 1.
|
| 715 |
color: var(--primary-color) !important;
|
| 716 |
}
|
| 717 |
|
| 718 |
.divider {
|
| 719 |
border: none !important;
|
| 720 |
-
border-top: 1px
|
| 721 |
margin: 1rem 0 !important;
|
| 722 |
}
|
| 723 |
|
| 724 |
.error-message {
|
| 725 |
background-color: var(--error-bg) !important;
|
| 726 |
-
border:
|
| 727 |
color: var(--error-text) !important;
|
| 728 |
-
padding:
|
| 729 |
border-radius: 8px !important;
|
| 730 |
display: flex !important;
|
| 731 |
align-items: flex-start !important;
|
| 732 |
-
gap: 0.
|
| 733 |
-
font-size: 0.
|
| 734 |
font-weight: 500 !important;
|
| 735 |
-
line-height: 1.
|
| 736 |
text-align: left !important;
|
| 737 |
width: 100%;
|
| 738 |
box-sizing: border-box;
|
|
@@ -744,33 +695,26 @@ Answer:"""
|
|
| 744 |
}
|
| 745 |
|
| 746 |
.error-icon {
|
| 747 |
-
font-size: 1.
|
| 748 |
line-height: 1 !important;
|
| 749 |
margin-top: 0.1rem !important;
|
| 750 |
}
|
| 751 |
|
| 752 |
-
.error-details {
|
| 753 |
-
font-size: 0.85rem !important;
|
| 754 |
-
color: var(--error-text) !important;
|
| 755 |
-
margin-top: 0.5rem !important;
|
| 756 |
-
opacity: 0.8;
|
| 757 |
-
}
|
| 758 |
-
|
| 759 |
.placeholder {
|
| 760 |
-
background-color:
|
| 761 |
-
border:
|
| 762 |
border-radius: 8px !important;
|
| 763 |
-
padding:
|
| 764 |
text-align: center !important;
|
| 765 |
color: var(--text-secondary) !important;
|
| 766 |
font-style: italic !important;
|
| 767 |
-
font-size:
|
| 768 |
width: 100%;
|
| 769 |
box-sizing: border-box;
|
| 770 |
}
|
| 771 |
|
| 772 |
.examples-section .gr-samples-table {
|
| 773 |
-
border:
|
| 774 |
border-radius: 8px !important;
|
| 775 |
overflow: hidden !important;
|
| 776 |
margin-top: 1rem !important;
|
|
@@ -778,7 +722,7 @@ Answer:"""
|
|
| 778 |
|
| 779 |
.examples-section .gr-samples-table th,
|
| 780 |
.examples-section .gr-samples-table td {
|
| 781 |
-
padding: 0.
|
| 782 |
border: none !important;
|
| 783 |
font-size: 0.95rem !important;
|
| 784 |
text-align: left !important;
|
|
@@ -786,22 +730,21 @@ Answer:"""
|
|
| 786 |
}
|
| 787 |
|
| 788 |
.examples-section .gr-samples-table th {
|
| 789 |
-
background-color:
|
| 790 |
-
font-weight:
|
| 791 |
color: var(--text-primary) !important;
|
| 792 |
}
|
| 793 |
|
| 794 |
.examples-section .gr-samples-table td {
|
| 795 |
-
background-color:
|
| 796 |
color: var(--text-primary) !important;
|
| 797 |
border-top: 1px solid var(--border-color) !important;
|
| 798 |
cursor: pointer !important;
|
| 799 |
-
transition: background 0.2s ease
|
| 800 |
}
|
| 801 |
|
| 802 |
.examples-section .gr-samples-table tr:hover td {
|
| 803 |
-
background-color:
|
| 804 |
-
transform: translateX(5px);
|
| 805 |
}
|
| 806 |
|
| 807 |
.gr-examples .gr-label,
|
|
@@ -811,36 +754,33 @@ Answer:"""
|
|
| 811 |
}
|
| 812 |
|
| 813 |
.app-footer-wrapper {
|
| 814 |
-
background:
|
| 815 |
-
border: 2px solid var(--border-color) !important;
|
| 816 |
border-radius: 12px !important;
|
| 817 |
-
padding: 1.
|
| 818 |
-
margin-top:
|
| 819 |
-
margin-bottom: 1.5rem !important;
|
| 820 |
text-align: center !important;
|
| 821 |
color: var(--text-primary) !important;
|
|
|
|
| 822 |
}
|
| 823 |
|
| 824 |
.app-footer p {
|
| 825 |
margin: 0 !important;
|
| 826 |
-
|
| 827 |
-
font-size: 0.95rem !important;
|
| 828 |
color: var(--text-secondary) !important;
|
| 829 |
-
line-height: 1.
|
| 830 |
background-color: transparent !important;
|
| 831 |
text-align: center !important;
|
| 832 |
-
white-space: normal !important;
|
| 833 |
}
|
| 834 |
|
| 835 |
.app-footer strong, .app-footer b {
|
| 836 |
-
font-weight:
|
| 837 |
color: var(--primary-color) !important;
|
| 838 |
}
|
| 839 |
|
| 840 |
.app-footer a {
|
| 841 |
color: var(--primary-color) !important;
|
| 842 |
text-decoration: underline !important;
|
| 843 |
-
font-weight:
|
| 844 |
}
|
| 845 |
|
| 846 |
.app-footer a:hover {
|
|
@@ -850,10 +790,11 @@ Answer:"""
|
|
| 850 |
@media (max-width: 768px) {
|
| 851 |
.gradio-container {
|
| 852 |
padding: 1rem !important;
|
|
|
|
| 853 |
}
|
| 854 |
|
| 855 |
.app-header-title {
|
| 856 |
-
font-size:
|
| 857 |
}
|
| 858 |
|
| 859 |
.app-header-tagline {
|
|
@@ -861,7 +802,7 @@ Answer:"""
|
|
| 861 |
}
|
| 862 |
|
| 863 |
.section-title {
|
| 864 |
-
font-size: 1.
|
| 865 |
}
|
| 866 |
|
| 867 |
.input-column {
|
|
@@ -870,6 +811,7 @@ Answer:"""
|
|
| 870 |
|
| 871 |
.button-row {
|
| 872 |
flex-direction: column !important;
|
|
|
|
| 873 |
}
|
| 874 |
|
| 875 |
.gradio-button {
|
|
@@ -877,20 +819,20 @@ Answer:"""
|
|
| 877 |
}
|
| 878 |
|
| 879 |
.section-title-gradient-bar {
|
| 880 |
-
padding: 0.
|
| 881 |
}
|
| 882 |
|
| 883 |
.dashboard-card-content-area {
|
| 884 |
-
padding:
|
| 885 |
}
|
| 886 |
|
| 887 |
.output-content-wrapper {
|
| 888 |
-
min-height:
|
| 889 |
}
|
| 890 |
|
| 891 |
.placeholder {
|
| 892 |
padding: 1.5rem 1rem !important;
|
| 893 |
-
font-size:
|
| 894 |
}
|
| 895 |
}
|
| 896 |
"""
|
|
|
|
| 249 |
def query_interface_wrapper(api_key: str, query: str, state: str) -> str:
|
| 250 |
# Basic client-side validation for immediate feedback (redundant but good UX)
|
| 251 |
if not api_key or not api_key.strip() or not api_key.startswith("sk-"):
|
| 252 |
+
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'>OpenAI</a>.</div>"
|
| 253 |
if not state or state is None:
|
| 254 |
+
return "<div class='error-message'><span class='error-icon'>⚠️</span>Please select a valid state from the list.</div>"
|
| 255 |
if not query or not query.strip():
|
| 256 |
+
return "<div class='error-message'><span class='error-icon'>⚠️</span>Please enter your question in the text box.</div>"
|
| 257 |
|
| 258 |
# Call the core processing logic
|
| 259 |
result = self.process_query(query=query, state=state, openai_api_key=api_key)
|
|
|
|
| 293 |
example_queries.append(["What basic rights do tenants have?", "California"])
|
| 294 |
|
| 295 |
custom_css = """
|
| 296 |
+
/* Import modern fonts from Google Fonts */
|
| 297 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700&display=swap');
|
| 298 |
|
| 299 |
+
/* Root variables for the single light orange theme */
|
| 300 |
:root {
|
| 301 |
+
--primary-color: #FF8C00; /* Orange for buttons and accents */
|
| 302 |
+
--primary-hover: #E07B00; /* Darker orange for hover states */
|
| 303 |
+
--background-page: #FFE8CC; /* Light orange background for the page */
|
| 304 |
+
--background-card: #FFFFFF; /* White background for cards */
|
| 305 |
+
--text-primary: #333333; /* Dark gray for primary text */
|
| 306 |
+
--text-secondary: #666666; /* Lighter gray for secondary text */
|
| 307 |
+
--border-color: #E5E5E5; /* Light gray for borders */
|
| 308 |
+
--border-focus: #FF8C00; /* Orange for focused input borders */
|
| 309 |
+
--shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
|
| 310 |
+
--shadow-md: 0 4px 8px rgba(0,0,0,0.1);
|
| 311 |
+
--error-bg: #FFF0E0; /* Light orange for error background */
|
| 312 |
+
--error-border: #FFD2B2; /* Slightly darker orange for error borders */
|
| 313 |
+
--error-text: #E05C00; /* Orange for error text */
|
| 314 |
+
--gradient-start: #FFDAB3; /* Lighter orange for gradient start */
|
| 315 |
+
--gradient-end: #FFF5E6; /* Very light orange-cream for gradient end */
|
|
|
|
|
|
|
| 316 |
}
|
| 317 |
|
| 318 |
body, html {
|
| 319 |
+
background-color: var(--background-page) !important;
|
| 320 |
color: var(--text-primary) !important;
|
| 321 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 322 |
+
margin: 0;
|
| 323 |
+
padding: 0;
|
| 324 |
}
|
| 325 |
|
| 326 |
.gradio-container {
|
| 327 |
+
max-width: 1000px !important;
|
| 328 |
+
margin: 2rem auto !important;
|
| 329 |
+
padding: 2rem !important;
|
| 330 |
+
background-color: var(--background-page) !important;
|
|
|
|
| 331 |
box-shadow: none !important;
|
| 332 |
color: var(--text-primary) !important;
|
| 333 |
}
|
| 334 |
|
| 335 |
+
.main-dashboard-container {
|
| 336 |
+
display: flex !important;
|
| 337 |
+
flex-direction: column !important;
|
| 338 |
+
gap: 2rem !important; /* Increased spacing between sections */
|
| 339 |
}
|
| 340 |
|
| 341 |
.app-header-wrapper {
|
| 342 |
background: linear-gradient(145deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
|
| 343 |
+
border-radius: 12px !important;
|
| 344 |
+
padding: 3rem 2rem !important;
|
| 345 |
+
margin-bottom: 2rem !important;
|
|
|
|
| 346 |
box-shadow: var(--shadow-md) !important;
|
|
|
|
|
|
|
| 347 |
text-align: center !important;
|
| 348 |
color: var(--text-primary) !important;
|
| 349 |
}
|
| 350 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
.app-header-logo {
|
| 352 |
+
font-size: 6rem !important;
|
| 353 |
+
margin-bottom: 1rem !important;
|
| 354 |
display: block !important;
|
| 355 |
color: var(--primary-color) !important;
|
|
|
|
|
|
|
| 356 |
animation: float-icon 3s ease-in-out infinite alternate;
|
| 357 |
}
|
| 358 |
|
|
|
|
| 364 |
|
| 365 |
.app-header-title {
|
| 366 |
font-family: 'Poppins', sans-serif !important;
|
| 367 |
+
font-size: 2.5rem !important;
|
| 368 |
+
font-weight: 700 !important;
|
| 369 |
color: var(--text-primary) !important;
|
| 370 |
+
margin: 0 0 0.5rem 0 !important;
|
| 371 |
+
line-height: 1.2 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
}
|
| 373 |
|
| 374 |
.app-header-tagline {
|
| 375 |
+
font-size: 1.1rem !important;
|
| 376 |
color: var(--text-secondary) !important;
|
| 377 |
font-weight: 400 !important;
|
| 378 |
margin: 0 !important;
|
| 379 |
+
max-width: 600px;
|
| 380 |
+
margin: 0 auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 381 |
}
|
| 382 |
|
| 383 |
.dashboard-card-section {
|
| 384 |
+
background-color: var(--background-card) !important;
|
|
|
|
| 385 |
border-radius: 12px !important;
|
| 386 |
padding: 0 !important;
|
| 387 |
box-shadow: var(--shadow-sm) !important;
|
| 388 |
+
transition: transform 0.2s ease, box-shadow 0.2s ease !important;
|
|
|
|
| 389 |
color: var(--text-primary) !important;
|
| 390 |
}
|
| 391 |
|
| 392 |
.dashboard-card-section:hover {
|
| 393 |
box-shadow: var(--shadow-md) !important;
|
| 394 |
+
transform: translateY(-2px) !important;
|
| 395 |
}
|
| 396 |
|
| 397 |
.full-width-center {
|
|
|
|
| 405 |
|
| 406 |
.section-title-gradient-bar {
|
| 407 |
background: linear-gradient(145deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
|
| 408 |
+
padding: 1rem 1.5rem !important;
|
| 409 |
+
border-top-left-radius: 12px !important;
|
| 410 |
+
border-top-right-radius: 12px !important;
|
| 411 |
margin-bottom: 0 !important;
|
| 412 |
text-align: center !important;
|
| 413 |
box-sizing: border-box;
|
|
|
|
| 417 |
|
| 418 |
.section-title {
|
| 419 |
font-family: 'Poppins', sans-serif !important;
|
| 420 |
+
font-size: 1.5rem !important;
|
| 421 |
+
font-weight: 600 !important;
|
| 422 |
color: var(--text-primary) !important;
|
| 423 |
margin: 0 !important;
|
| 424 |
+
line-height: 1.2 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
}
|
| 426 |
|
| 427 |
.dashboard-card-content-area {
|
| 428 |
+
padding: 1.5rem !important;
|
| 429 |
+
background-color: var(--background-card) !important;
|
| 430 |
+
border-bottom-left-radius: 12px !important;
|
| 431 |
+
border-bottom-right-radius: 12px !important;
|
| 432 |
box-sizing: border-box;
|
| 433 |
width: 100%;
|
| 434 |
color: var(--text-primary) !important;
|
| 435 |
}
|
| 436 |
|
| 437 |
.dashboard-card-section p {
|
| 438 |
+
line-height: 1.6 !important;
|
| 439 |
color: var(--text-primary) !important;
|
| 440 |
font-size: 1rem !important;
|
| 441 |
text-align: left !important;
|
|
|
|
| 442 |
margin: 0 !important;
|
| 443 |
padding: 0 !important;
|
|
|
|
| 444 |
}
|
| 445 |
|
| 446 |
.dashboard-card-section strong, .dashboard-card-section b {
|
| 447 |
+
font-weight: 600 !important;
|
| 448 |
color: var(--primary-color) !important;
|
| 449 |
}
|
| 450 |
|
|
|
|
| 462 |
.gradio-textbox input,
|
| 463 |
.gradio-radio label,
|
| 464 |
.placeholder {
|
| 465 |
+
background-color: #FFFFFF !important;
|
| 466 |
color: var(--text-primary) !important;
|
| 467 |
+
border-radius: 8px !important;
|
| 468 |
+
box-shadow: var(--shadow-sm) !important;
|
| 469 |
}
|
| 470 |
|
| 471 |
.gradio-textbox {
|
| 472 |
+
margin-bottom: 1rem !important;
|
| 473 |
}
|
| 474 |
|
| 475 |
.gradio-textbox textarea,
|
| 476 |
.gradio-textbox input {
|
| 477 |
+
border: 1px solid var(--border-color) !important;
|
| 478 |
border-radius: 8px !important;
|
| 479 |
+
padding: 0.75rem 1rem !important;
|
| 480 |
+
font-size: 1rem !important;
|
| 481 |
font-family: 'Inter', sans-serif !important;
|
| 482 |
color: var(--text-primary) !important;
|
| 483 |
transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
}
|
| 485 |
|
| 486 |
.gradio-textbox textarea:focus,
|
| 487 |
.gradio-textbox input:focus {
|
| 488 |
outline: none !important;
|
| 489 |
border-color: var(--border-focus) !important;
|
| 490 |
+
box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1) !important;
|
| 491 |
}
|
| 492 |
|
| 493 |
.gradio-radio {
|
|
|
|
| 504 |
justify-content: center !important;
|
| 505 |
align-items: center !important;
|
| 506 |
padding: 0.75rem 1rem !important;
|
| 507 |
+
border: 1px solid var(--border-color) !important;
|
| 508 |
border-radius: 8px !important;
|
| 509 |
color: var(--text-primary) !important;
|
| 510 |
font-weight: 500 !important;
|
| 511 |
cursor: pointer !important;
|
| 512 |
transition: all 0.2s ease-out !important;
|
| 513 |
+
margin: 0.25rem 0 !important;
|
| 514 |
+
width: 100% !important;
|
|
|
|
| 515 |
box-sizing: border-box !important;
|
| 516 |
}
|
| 517 |
|
| 518 |
.gradio-radio label span.text-lg {
|
| 519 |
+
font-weight: 500 !important;
|
| 520 |
color: var(--text-primary) !important;
|
| 521 |
+
font-size: 1rem !important;
|
| 522 |
}
|
| 523 |
|
| 524 |
.gradio-radio label:hover {
|
|
|
|
| 525 |
border-color: var(--primary-color) !important;
|
| 526 |
box-shadow: var(--shadow-md) !important;
|
|
|
|
| 527 |
}
|
| 528 |
|
| 529 |
.gradio-radio input[type="radio"]:checked + label {
|
| 530 |
background-color: var(--primary-color) !important;
|
| 531 |
+
color: #FFFFFF !important;
|
| 532 |
+
border-color: var(--primary-color) !important;
|
| 533 |
box-shadow: var(--shadow-md) !important;
|
|
|
|
| 534 |
}
|
| 535 |
|
| 536 |
.gradio-radio input[type="radio"]:checked + label span.text-lg {
|
| 537 |
+
color: #FFFFFF !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 538 |
}
|
| 539 |
|
| 540 |
.gradio-textbox label,
|
|
|
|
| 542 |
font-weight: 600 !important;
|
| 543 |
color: var(--text-primary) !important;
|
| 544 |
font-size: 1rem !important;
|
| 545 |
+
margin-bottom: 0.5rem !important;
|
| 546 |
display: block !important;
|
| 547 |
text-align: left !important;
|
| 548 |
}
|
|
|
|
| 550 |
.gr-prose {
|
| 551 |
font-size: 0.9rem !important;
|
| 552 |
color: var(--text-secondary) !important;
|
| 553 |
+
margin-top: 0.5rem !important;
|
| 554 |
text-align: left !important;
|
| 555 |
background-color: transparent !important;
|
| 556 |
}
|
|
|
|
| 558 |
.input-column {
|
| 559 |
display: flex !important;
|
| 560 |
flex-direction: column !important;
|
| 561 |
+
gap: 1.5rem !important;
|
| 562 |
+
margin-bottom: 1rem !important;
|
| 563 |
}
|
| 564 |
|
| 565 |
.input-field {
|
|
|
|
| 575 |
}
|
| 576 |
|
| 577 |
.gradio-button {
|
| 578 |
+
padding: 0.75rem 1.5rem !important;
|
| 579 |
+
border-radius: 8px !important;
|
| 580 |
font-weight: 600 !important;
|
| 581 |
font-size: 1rem !important;
|
| 582 |
+
font-family: 'Inter', sans-serif !important;
|
| 583 |
transition: all 0.2s ease-out !important;
|
| 584 |
cursor: pointer !important;
|
| 585 |
+
border: none !important;
|
| 586 |
text-align: center !important;
|
|
|
|
| 587 |
}
|
| 588 |
|
| 589 |
.gr-button-primary {
|
| 590 |
background-color: var(--primary-color) !important;
|
| 591 |
+
color: #FFFFFF !important;
|
| 592 |
box-shadow: var(--shadow-sm) !important;
|
| 593 |
}
|
| 594 |
|
| 595 |
.gr-button-primary:hover {
|
| 596 |
background-color: var(--primary-hover) !important;
|
| 597 |
box-shadow: var(--shadow-md) !important;
|
| 598 |
+
transform: translateY(-1px) !important;
|
| 599 |
}
|
| 600 |
|
| 601 |
.gr-button-primary:active {
|
| 602 |
+
transform: translateY(0) !important;
|
| 603 |
+
box-shadow: var(--shadow-sm) !important;
|
| 604 |
}
|
| 605 |
|
| 606 |
.gr-button-secondary {
|
| 607 |
+
background-color: #F5F5F5 !important;
|
| 608 |
color: var(--text-primary) !important;
|
| 609 |
+
border: 1px solid var(--border-color) !important;
|
| 610 |
}
|
| 611 |
|
| 612 |
.gr-button-secondary:hover {
|
| 613 |
+
background-color: #E5E5E5 !important;
|
| 614 |
border-color: var(--primary-color) !important;
|
| 615 |
+
transform: translateY(-1px) !important;
|
| 616 |
}
|
| 617 |
|
| 618 |
.gr-button-secondary:active {
|
| 619 |
+
transform: translateY(0) !important;
|
| 620 |
box-shadow: none !important;
|
| 621 |
}
|
| 622 |
|
| 623 |
.output-content-wrapper {
|
| 624 |
+
background-color: #FFFFFF !important;
|
|
|
|
| 625 |
border-radius: 8px !important;
|
| 626 |
padding: 1.5rem !important;
|
| 627 |
+
min-height: 120px !important;
|
| 628 |
color: var(--text-primary) !important;
|
| 629 |
display: flex;
|
| 630 |
flex-direction: column;
|
| 631 |
justify-content: center;
|
| 632 |
align-items: center;
|
| 633 |
+
box-shadow: var(--shadow-sm) !important;
|
| 634 |
}
|
| 635 |
|
| 636 |
.animated-output-content {
|
| 637 |
opacity: 0;
|
| 638 |
+
animation: fadeInAndSlideUp 0.5s ease-out forwards;
|
| 639 |
width: 100%;
|
| 640 |
white-space: pre-wrap;
|
| 641 |
overflow-wrap: break-word;
|
|
|
|
| 645 |
}
|
| 646 |
|
| 647 |
@keyframes fadeInAndSlideUp {
|
| 648 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 649 |
to { opacity: 1; transform: translateY(0); }
|
| 650 |
}
|
| 651 |
|
| 652 |
.response-header {
|
| 653 |
+
font-size: 1.2rem !important;
|
| 654 |
+
font-weight: 600 !important;
|
| 655 |
color: var(--primary-color) !important;
|
| 656 |
margin-bottom: 0.75rem !important;
|
| 657 |
display: flex !important;
|
| 658 |
align-items: center !important;
|
| 659 |
+
gap: 0.5rem !important;
|
| 660 |
text-align: left !important;
|
| 661 |
width: 100%;
|
|
|
|
| 662 |
}
|
| 663 |
|
| 664 |
.response-icon {
|
| 665 |
+
font-size: 1.3rem !important;
|
| 666 |
color: var(--primary-color) !important;
|
| 667 |
}
|
| 668 |
|
| 669 |
.divider {
|
| 670 |
border: none !important;
|
| 671 |
+
border-top: 1px solid var(--border-color) !important;
|
| 672 |
margin: 1rem 0 !important;
|
| 673 |
}
|
| 674 |
|
| 675 |
.error-message {
|
| 676 |
background-color: var(--error-bg) !important;
|
| 677 |
+
border: 1px solid var(--error-border) !important;
|
| 678 |
color: var(--error-text) !important;
|
| 679 |
+
padding: 1rem !important;
|
| 680 |
border-radius: 8px !important;
|
| 681 |
display: flex !important;
|
| 682 |
align-items: flex-start !important;
|
| 683 |
+
gap: 0.5rem !important;
|
| 684 |
+
font-size: 0.9rem !important;
|
| 685 |
font-weight: 500 !important;
|
| 686 |
+
line-height: 1.5 !important;
|
| 687 |
text-align: left !important;
|
| 688 |
width: 100%;
|
| 689 |
box-sizing: border-box;
|
|
|
|
| 695 |
}
|
| 696 |
|
| 697 |
.error-icon {
|
| 698 |
+
font-size: 1.2rem !important;
|
| 699 |
line-height: 1 !important;
|
| 700 |
margin-top: 0.1rem !important;
|
| 701 |
}
|
| 702 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
.placeholder {
|
| 704 |
+
background-color: #FFFFFF !important;
|
| 705 |
+
border: 1px dashed var(--border-color) !important;
|
| 706 |
border-radius: 8px !important;
|
| 707 |
+
padding: 2rem 1.5rem !important;
|
| 708 |
text-align: center !important;
|
| 709 |
color: var(--text-secondary) !important;
|
| 710 |
font-style: italic !important;
|
| 711 |
+
font-size: 1rem !important;
|
| 712 |
width: 100%;
|
| 713 |
box-sizing: border-box;
|
| 714 |
}
|
| 715 |
|
| 716 |
.examples-section .gr-samples-table {
|
| 717 |
+
border: 1px solid var(--border-color) !important;
|
| 718 |
border-radius: 8px !important;
|
| 719 |
overflow: hidden !important;
|
| 720 |
margin-top: 1rem !important;
|
|
|
|
| 722 |
|
| 723 |
.examples-section .gr-samples-table th,
|
| 724 |
.examples-section .gr-samples-table td {
|
| 725 |
+
padding: 0.75rem 1rem !important;
|
| 726 |
border: none !important;
|
| 727 |
font-size: 0.95rem !important;
|
| 728 |
text-align: left !important;
|
|
|
|
| 730 |
}
|
| 731 |
|
| 732 |
.examples-section .gr-samples-table th {
|
| 733 |
+
background-color: #F5F5F5 !important;
|
| 734 |
+
font-weight: 600 !important;
|
| 735 |
color: var(--text-primary) !important;
|
| 736 |
}
|
| 737 |
|
| 738 |
.examples-section .gr-samples-table td {
|
| 739 |
+
background-color: #FFFFFF !important;
|
| 740 |
color: var(--text-primary) !important;
|
| 741 |
border-top: 1px solid var(--border-color) !important;
|
| 742 |
cursor: pointer !important;
|
| 743 |
+
transition: background 0.2s ease !important;
|
| 744 |
}
|
| 745 |
|
| 746 |
.examples-section .gr-samples-table tr:hover td {
|
| 747 |
+
background-color: #F9F9F9 !important;
|
|
|
|
| 748 |
}
|
| 749 |
|
| 750 |
.gr-examples .gr-label,
|
|
|
|
| 754 |
}
|
| 755 |
|
| 756 |
.app-footer-wrapper {
|
| 757 |
+
background-color: var(--background-card) !important;
|
|
|
|
| 758 |
border-radius: 12px !important;
|
| 759 |
+
padding: 1.5rem !important;
|
| 760 |
+
margin-top: 2rem !important;
|
|
|
|
| 761 |
text-align: center !important;
|
| 762 |
color: var(--text-primary) !important;
|
| 763 |
+
box-shadow: var(--shadow-sm) !important;
|
| 764 |
}
|
| 765 |
|
| 766 |
.app-footer p {
|
| 767 |
margin: 0 !important;
|
| 768 |
+
font-size: 0.9rem !important;
|
|
|
|
| 769 |
color: var(--text-secondary) !important;
|
| 770 |
+
line-height: 1.5 !important;
|
| 771 |
background-color: transparent !important;
|
| 772 |
text-align: center !important;
|
|
|
|
| 773 |
}
|
| 774 |
|
| 775 |
.app-footer strong, .app-footer b {
|
| 776 |
+
font-weight: 600 !important;
|
| 777 |
color: var(--primary-color) !important;
|
| 778 |
}
|
| 779 |
|
| 780 |
.app-footer a {
|
| 781 |
color: var(--primary-color) !important;
|
| 782 |
text-decoration: underline !important;
|
| 783 |
+
font-weight: 500 !important;
|
| 784 |
}
|
| 785 |
|
| 786 |
.app-footer a:hover {
|
|
|
|
| 790 |
@media (max-width: 768px) {
|
| 791 |
.gradio-container {
|
| 792 |
padding: 1rem !important;
|
| 793 |
+
margin: 1rem auto !important;
|
| 794 |
}
|
| 795 |
|
| 796 |
.app-header-title {
|
| 797 |
+
font-size: 2rem !important;
|
| 798 |
}
|
| 799 |
|
| 800 |
.app-header-tagline {
|
|
|
|
| 802 |
}
|
| 803 |
|
| 804 |
.section-title {
|
| 805 |
+
font-size: 1.3rem !important;
|
| 806 |
}
|
| 807 |
|
| 808 |
.input-column {
|
|
|
|
| 811 |
|
| 812 |
.button-row {
|
| 813 |
flex-direction: column !important;
|
| 814 |
+
gap: 0.75rem !important;
|
| 815 |
}
|
| 816 |
|
| 817 |
.gradio-button {
|
|
|
|
| 819 |
}
|
| 820 |
|
| 821 |
.section-title-gradient-bar {
|
| 822 |
+
padding: 0.75rem 1rem !important;
|
| 823 |
}
|
| 824 |
|
| 825 |
.dashboard-card-content-area {
|
| 826 |
+
padding: 1rem !important;
|
| 827 |
}
|
| 828 |
|
| 829 |
.output-content-wrapper {
|
| 830 |
+
min-height: 100px !important;
|
| 831 |
}
|
| 832 |
|
| 833 |
.placeholder {
|
| 834 |
padding: 1.5rem 1rem !important;
|
| 835 |
+
font-size: 0.9rem !important;
|
| 836 |
}
|
| 837 |
}
|
| 838 |
"""
|