Nischal Subedi
commited on
Commit
·
203af54
1
Parent(s):
014cf1b
UI update
Browse files
app.py
CHANGED
@@ -295,7 +295,6 @@ Answer:"""
|
|
295 |
else: # If states failed to load, provide a generic example (e.g., California)
|
296 |
example_queries.append(["What basic rights do tenants have?", "California"])
|
297 |
|
298 |
-
|
299 |
custom_css = f"""
|
300 |
/* Import legible fonts from Google Fonts */
|
301 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap');
|
@@ -319,7 +318,6 @@ Answer:"""
|
|
319 |
}}
|
320 |
|
321 |
/* CRITICAL: FORCE GRADIO'S INTERNAL VARIABLES TO OUR CUSTOM LIGHT THEME VALUES */
|
322 |
-
/* This targets :root, html.dark, body.dark, and generic .dark classes to ensure precedence */
|
323 |
:root, html.dark, body.dark, .dark {{
|
324 |
/* General backgrounds */
|
325 |
--background-fill-primary: var(--custom-background-primary) !important;
|
@@ -381,268 +379,79 @@ Answer:"""
|
|
381 |
--color-error-background: var(--custom-error-bg) !important;
|
382 |
--color-error-border: var(--custom-error-border) !important;
|
383 |
|
384 |
-
/*
|
385 |
--block-border-color: var(--custom-border-color) !important;
|
386 |
--input-border-color: var(--custom-border-color) !important;
|
387 |
--input-label-color: var(--custom-text-primary) !important;
|
388 |
--link-text-color: var(--custom-primary-color) !important;
|
389 |
--link-text-color-hover: var(--custom-primary-hover) !important;
|
|
|
|
|
390 |
--scrollbar-thumb-color: var(--custom-border-color) !important;
|
391 |
--scrollbar-track-color: var(--custom-background-secondary) !important;
|
392 |
}}
|
393 |
|
394 |
-
/* Universal reset for certain properties to prevent unwanted inheritance/dark mode effects */
|
395 |
-
body, html, .gradio-app, .gradio-container, .gr-block, .gr-box, .gr-panel {{
|
396 |
-
transition: none !important; /* Extremely important to prevent theme transition flickering */
|
397 |
-
filter: none !important; /* Reset any potential CSS filters like invert() */
|
398 |
-
mix-blend-mode: normal !important; /* Reset blend modes */
|
399 |
-
}}
|
400 |
-
|
401 |
/* Base styles for html and body */
|
402 |
body, html {{
|
403 |
background-color: var(--custom-background-secondary) !important;
|
404 |
color: var(--custom-text-primary) !important;
|
|
|
405 |
}}
|
406 |
|
407 |
-
/* Target the main Gradio application
|
408 |
.gradio-app {{
|
409 |
background-color: var(--custom-background-secondary) !important;
|
410 |
color: var(--custom-text-primary) !important;
|
411 |
}}
|
412 |
|
413 |
/* Ensure all core Gradio blocks and components use our defined colors */
|
414 |
-
.
|
415 |
-
|
416 |
-
margin: 0 auto !important;
|
417 |
-
padding: 1.5rem !important;
|
418 |
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
419 |
-
background-color: var(--custom-background-secondary) !important;
|
420 |
-
box-shadow: none !important;
|
421 |
-
color: var(--custom-text-primary) !important;
|
422 |
-
}}
|
423 |
-
.main-dashboard-container > * {{
|
424 |
background-color: var(--custom-background-primary) !important;
|
425 |
-
border-color: var(--custom-border-color) !important;
|
426 |
color: var(--custom-text-primary) !important;
|
|
|
|
|
|
|
427 |
}}
|
428 |
|
429 |
-
/* Centering for
|
430 |
-
.app-header-
|
431 |
-
background: linear-gradient(145deg, var(--custom-background-primary) 0%, var(--custom-background-secondary) 100%) !important;
|
432 |
-
border: 2px solid var(--custom-border-color) !important;
|
433 |
-
border-radius: 16px !important;
|
434 |
-
padding: 2.5rem 1.5rem !important;
|
435 |
-
margin-bottom: 1.5rem !important;
|
436 |
-
box-shadow: var(--custom-shadow-md) !important;
|
437 |
-
position: relative;
|
438 |
-
overflow: hidden;
|
439 |
-
text-align: center !important; /* Ensure parent centers children */
|
440 |
-
color: var(--custom-text-primary) !important;
|
441 |
-
}}
|
442 |
-
/* Centering for the specific title/tagline elements within the header */
|
443 |
-
.app-header-logo {{
|
444 |
-
text-align: center !important; /* Force center for icon itself */
|
445 |
-
display: block !important;
|
446 |
-
margin: 0 auto !important; /* Center a block element */
|
447 |
-
color: var(--custom-primary-color) !important;
|
448 |
-
font-size: 8.5rem !important;
|
449 |
-
margin-bottom: 0.75rem !important;
|
450 |
-
}}
|
451 |
-
.app-header-title {{
|
452 |
text-align: center !important;
|
453 |
-
margin: 0 auto !important; /* Center a block element */
|
454 |
-
display: block !important;
|
455 |
-
width: fit-content !important; /* Shrink to content width */
|
456 |
-
font-family: 'Poppins', sans-serif !important;
|
457 |
-
font-size: 3rem !important;
|
458 |
-
font-weight: 800 !important;
|
459 |
-
color: var(--custom-text-primary) !important;
|
460 |
-
line-height: 1.1 !important;
|
461 |
-
letter-spacing: -0.03em !important;
|
462 |
-
}}
|
463 |
-
.app-header-tagline {{
|
464 |
-
text-align: center !important;
|
465 |
-
margin: 0 auto !important; /* Center a block element */
|
466 |
-
display: block !important;
|
467 |
-
width: fit-content !important; /* Shrink to content width */
|
468 |
-
font-size: 1.25rem !important;
|
469 |
-
color: var(--custom-text-secondary) !important;
|
470 |
-
font-weight: 400 !important;
|
471 |
-
max-width: 700px;
|
472 |
-
}}
|
473 |
-
|
474 |
-
|
475 |
-
.app-header-wrapper::before {{
|
476 |
-
content: '';
|
477 |
-
position: absolute;
|
478 |
-
top: 0;
|
479 |
-
left: 0;
|
480 |
-
width: 100%;
|
481 |
-
height: 100%;
|
482 |
-
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%);
|
483 |
-
z-index: 0;
|
484 |
-
opacity: 0.8;
|
485 |
-
pointer-events: none;
|
486 |
-
}}
|
487 |
-
@keyframes float-icon {{
|
488 |
-
0% {{ transform: translateY(0px); }}
|
489 |
-
50% {{ transform: translateY(-5px); }}
|
490 |
-
100% {{ transform: translateY(0px); }}
|
491 |
-
}}
|
492 |
-
|
493 |
-
/* General layout */
|
494 |
-
.main-dashboard-container {{
|
495 |
-
display: flex !important;
|
496 |
-
flex-direction: column !important;
|
497 |
-
gap: 1.25rem !important;
|
498 |
-
}}
|
499 |
-
.dashboard-card-section {{
|
500 |
-
background-color: var(--custom-background-primary) !important;
|
501 |
-
border: 2px solid var(--custom-border-color) !important;
|
502 |
-
border-radius: 12px !important;
|
503 |
-
padding: 0 !important;
|
504 |
-
box-shadow: var(--custom-shadow-sm) !important;
|
505 |
-
transition: all 0.3s ease-out !important;
|
506 |
-
cursor: default;
|
507 |
-
color: var(--custom-text-primary) !important;
|
508 |
-
}}
|
509 |
-
.dashboard-card-section:hover {{
|
510 |
-
box-shadow: var(--custom-shadow-md) !important;
|
511 |
-
transform: translateY(-3px) !important;
|
512 |
-
}}
|
513 |
-
.full-width-center {{
|
514 |
-
display: flex !important;
|
515 |
-
justify-content: center !important;
|
516 |
-
align-items: center !important;
|
517 |
width: 100% !important;
|
518 |
-
|
519 |
-
background-color: transparent !important;
|
520 |
-
text-align: center !important; /* Ensure content is centered */
|
521 |
-
}}
|
522 |
-
.section-title-gradient-bar {{
|
523 |
-
background-color: var(--custom-background-secondary) !important;
|
524 |
-
padding: 1.25rem 1.75rem !important;
|
525 |
-
border-top-left-radius: 10px !important;
|
526 |
-
border-top-right-radius: 10px !important;
|
527 |
-
margin-bottom: 0 !important;
|
528 |
-
text-align: center !important; /* Ensure parent centers its h3 child */
|
529 |
-
box-sizing: border-box;
|
530 |
-
width: 100%;
|
531 |
-
color: var(--custom-text-primary) !important;
|
532 |
-
}}
|
533 |
-
/* Centering for section titles and their underline */
|
534 |
-
.section-title {{
|
535 |
-
font-family: 'Poppins', sans-serif !important;
|
536 |
-
font-size: 1.7rem !important;
|
537 |
-
font-weight: 700 !important;
|
538 |
-
color: var(--custom-text-primary) !important;
|
539 |
-
margin: 0 auto !important; /* Center a block element */
|
540 |
-
padding-bottom: 0 !important;
|
541 |
-
border-bottom: 2px solid var(--custom-border-color) !important;
|
542 |
-
line-height: 1.1 !important;
|
543 |
-
display: block !important; /* Force block behavior for margin auto */
|
544 |
-
width: fit-content !important; /* Shrink to content width for short underline */
|
545 |
-
text-align: center !important; /* Center text within its own width */
|
546 |
-
letter-spacing: -0.01em !important;
|
547 |
-
}}
|
548 |
-
.dashboard-card-content-area {{
|
549 |
-
padding: 0 1.75rem 1.75rem 1.75rem !important;
|
550 |
-
background-color: var(--custom-background-primary) !important;
|
551 |
-
box-sizing: border-box;
|
552 |
-
width: 100%;
|
553 |
-
color: var(--custom-text-primary) !important;
|
554 |
-
}}
|
555 |
-
.dashboard-card-section p {{
|
556 |
-
line-height: 1.7 !important;
|
557 |
-
color: var(--custom-text-primary) !important;
|
558 |
-
font-size: 1rem !important;
|
559 |
-
text-align: left !important; /* Default for most paragraphs */
|
560 |
-
background-color: transparent !important;
|
561 |
-
margin: 0 !important;
|
562 |
-
padding: 0 !important;
|
563 |
-
white-space: normal !important;
|
564 |
-
}}
|
565 |
-
.dashboard-card-section strong, .dashboard-card-section b {{
|
566 |
-
font-weight: 700 !important;
|
567 |
-
color: var(--custom-primary-color) !important;
|
568 |
-
}}
|
569 |
-
.gr-block, .gr-box, .gr-prose, .gr-form, .gr-panel,
|
570 |
-
.gr-columns, .gr-column {{
|
571 |
-
background-color: var(--custom-background-primary) !important;
|
572 |
-
color: var(--custom-text-primary) !important;
|
573 |
-
border-color: var(--custom-border-color) !important;
|
574 |
-
white-space: normal !important;
|
575 |
-
overflow-wrap: break-word;
|
576 |
-
word-break: break-word;
|
577 |
-
}}
|
578 |
-
.gradio-html, .gradio-markdown {{
|
579 |
-
background-color: transparent !important;
|
580 |
-
color: var(--custom-text-primary) !important;
|
581 |
-
white-space: normal !important;
|
582 |
-
overflow-wrap: break-word;
|
583 |
-
word-break: break-word;
|
584 |
}}
|
585 |
-
|
586 |
-
|
|
|
|
|
|
|
|
|
587 |
}}
|
588 |
|
|
|
589 |
.gradio-textbox textarea,
|
590 |
-
.gradio-textbox input
|
591 |
-
.gradio-radio label,
|
592 |
-
.placeholder {{
|
593 |
background-color: var(--custom-background-primary) !important;
|
594 |
color: var(--custom-text-primary) !important;
|
595 |
-
}}
|
596 |
-
.gradio-textbox {{
|
597 |
-
margin-bottom: 0.5rem !important;
|
598 |
-
}}
|
599 |
-
.gradio-textbox textarea,
|
600 |
-
.gradio-textbox input {{
|
601 |
border: 2px solid var(--custom-border-color) !important;
|
602 |
-
border-radius: 8px !important;
|
603 |
-
padding: 0.85rem 1rem !important;
|
604 |
-
font-size: 0.98rem !important;
|
605 |
-
font-family: 'Inter', sans-serif !important;
|
606 |
-
color: var(--custom-text-primary) !important;
|
607 |
-
transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
|
608 |
box-shadow: var(--custom-shadow-sm) !important;
|
609 |
}}
|
610 |
-
.gradio-textbox .scroll-hide {{
|
611 |
-
background-color: var(--custom-background-primary) !important;
|
612 |
-
}}
|
613 |
.gradio-textbox textarea:focus,
|
614 |
.gradio-textbox input:focus {{
|
615 |
-
outline: none !important;
|
616 |
border-color: var(--custom-border-focus) !important;
|
617 |
box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.2) !important;
|
|
|
618 |
}}
|
619 |
-
|
620 |
-
|
621 |
-
margin-top: 1rem !important;
|
622 |
-
}}
|
623 |
-
.gradio-radio input[type="radio"] {{
|
624 |
-
display: none !important;
|
625 |
-
}}
|
626 |
.gradio-radio label {{
|
627 |
-
|
628 |
-
justify-content: center !important;
|
629 |
-
align-items: center !important;
|
630 |
-
padding: 0.75rem 1rem !important;
|
631 |
-
border: 2px solid var(--custom-border-color) !important;
|
632 |
-
border-radius: 8px !important;
|
633 |
color: var(--custom-text-primary) !important;
|
634 |
-
|
635 |
-
cursor: pointer !important;
|
636 |
-
transition: all 0.2s ease-out !important;
|
637 |
box-shadow: var(--custom-shadow-sm) !important;
|
638 |
-
margin: 0.2rem 0 !important;
|
639 |
-
width: 100 !important;
|
640 |
-
box-sizing: border-box !important;
|
641 |
}}
|
642 |
.gradio-radio label span.text-lg {{
|
643 |
-
font-weight: 600 !important;
|
644 |
color: var(--custom-text-primary) !important;
|
645 |
-
font-size: 0.98rem !important;
|
646 |
}}
|
647 |
.gradio-radio label:hover {{
|
648 |
background-color: var(--custom-background-secondary) !important;
|
@@ -652,73 +461,21 @@ Answer:"""
|
|
652 |
}}
|
653 |
.gradio-radio input[type="radio"]:checked + label {{
|
654 |
background-color: var(--custom-primary-color) !important;
|
655 |
-
color: white !important;
|
656 |
border-color: var(--custom-primary-hover) !important;
|
657 |
box-shadow: var(--custom-shadow-md) !important;
|
658 |
-
transform: translateY(-1px) !important;
|
659 |
}}
|
660 |
.gradio-radio input[type="radio"]:checked + label span.text-lg {{
|
661 |
-
color: white !important;
|
662 |
-
}}
|
663 |
-
.gradio-radio .gr-form {{
|
664 |
-
padding: 0 !important;
|
665 |
-
}}
|
666 |
-
.gradio-textbox label,
|
667 |
-
.gradio-radio > label {{
|
668 |
-
font-weight: 600 !important;
|
669 |
-
color: var(--custom-text-primary) !important;
|
670 |
-
font-size: 1rem !important;
|
671 |
-
margin-bottom: 0.6rem !important;
|
672 |
-
display: block !important;
|
673 |
-
text-align: left !important;
|
674 |
-
}}
|
675 |
-
.gr-prose {{
|
676 |
-
font-size: 0.9rem !important;
|
677 |
-
color: var(--custom-text-secondary) !important;
|
678 |
-
margin-top: 0.4rem !important;
|
679 |
-
text-align: left !important;
|
680 |
-
background-color: transparent !important;
|
681 |
-
}}
|
682 |
-
.input-column {{
|
683 |
-
display: flex !important;
|
684 |
-
flex-direction: column !important;
|
685 |
-
gap: 1.25rem !important;
|
686 |
-
margin-bottom: 0.5rem !important;
|
687 |
-
}}
|
688 |
-
.input-field {{
|
689 |
-
flex: none !important;
|
690 |
-
width: 100% !important;
|
691 |
-
}}
|
692 |
-
.button-row {{
|
693 |
-
display: flex !important;
|
694 |
-
gap: 1rem !important;
|
695 |
-
justify-content: flex-end !important;
|
696 |
-
margin-top: 1.5rem !important;
|
697 |
-
}}
|
698 |
-
.gradio-button {{
|
699 |
-
padding: 0.85rem 1.8rem !important;
|
700 |
-
border-radius: 9px !important;
|
701 |
-
font-weight: 600 !important;
|
702 |
-
font-size: 1rem !important;
|
703 |
-
transition: all 0.2s ease-out !important;
|
704 |
-
cursor: pointer !important;
|
705 |
-
border: 2px solid transparent !important;
|
706 |
-
text-align: center !important;
|
707 |
-
color: var(--custom-text-primary) !important; /* Default for secondary buttons */
|
708 |
}}
|
|
|
|
|
709 |
.gr-button-primary {{
|
710 |
background-color: var(--custom-primary-color) !important;
|
711 |
-
color: white !important;
|
712 |
-
box-shadow: var(--custom-shadow-sm) !important;
|
713 |
}}
|
714 |
.gr-button-primary:hover {{
|
715 |
background-color: var(--custom-primary-hover) !important;
|
716 |
-
box-shadow: var(--custom-shadow-md) !important;
|
717 |
-
transform: translateY(-2px) !important;
|
718 |
-
}}
|
719 |
-
.gr-button-primary:active {{
|
720 |
-
transform: translateY(1px) !important;
|
721 |
-
box-shadow: none !important;
|
722 |
}}
|
723 |
.gr-button-secondary {{
|
724 |
background-color: transparent !important;
|
@@ -728,171 +485,99 @@ Answer:"""
|
|
728 |
.gr-button-secondary:hover {{
|
729 |
background-color: var(--custom-background-secondary) !important;
|
730 |
border-color: var(--custom-primary-color) !important;
|
731 |
-
transform: translateY(-2px) !important;
|
732 |
-
}}
|
733 |
-
.gr-button-secondary:active {{
|
734 |
-
transform: translateY(1px) !important;
|
735 |
-
box-shadow: none !important;
|
736 |
-
}}
|
737 |
-
.output-content-wrapper {{
|
738 |
-
background-color: var(--custom-background-primary) !important;
|
739 |
-
border: 2px solid var(--custom-border-color) !important;
|
740 |
-
border-radius: 8px !important;
|
741 |
-
padding: 1.5rem !important;
|
742 |
-
min-height: 150px !important;
|
743 |
-
color: var(--custom-text-primary) !important;
|
744 |
-
display: flex;
|
745 |
-
flex-direction: column;
|
746 |
-
justify-content: center;
|
747 |
-
align-items: center;
|
748 |
-
}}
|
749 |
-
.animated-output-content {{
|
750 |
-
opacity: 0;
|
751 |
-
animation: fadeInAndSlideUp 0.7s ease-out forwards;
|
752 |
-
width: 100%;
|
753 |
-
white-space: pre-wrap;
|
754 |
-
overflow-wrap: break-word;
|
755 |
-
word-break: break-word;
|
756 |
-
text-align: left !important;
|
757 |
-
color: var(--custom-text-primary) !important;
|
758 |
-
}}
|
759 |
-
@keyframes fadeInAndSlideUp {{
|
760 |
-
from {{ opacity: 0; transform: translateY(15px); }}
|
761 |
-
to {{ opacity: 1; transform: translateY(0); }}
|
762 |
-
}}
|
763 |
-
.response-header {{
|
764 |
-
font-size: 1.3rem !important;
|
765 |
-
font-weight: 700 !important;
|
766 |
-
color: var(--custom-primary-color) !important;
|
767 |
-
margin-bottom: 0.75rem !important;
|
768 |
-
display: flex !important;
|
769 |
-
align-items: center !important;
|
770 |
-
gap: 0.6rem !important;
|
771 |
-
text-align: left !important;
|
772 |
-
width: 100%;
|
773 |
-
justify-content: flex-start;
|
774 |
-
}}
|
775 |
-
.response-icon {{
|
776 |
-
font-size: 1.5rem !important;
|
777 |
-
color: var(--custom-primary-color) !important;
|
778 |
-
}}
|
779 |
-
.divider {{
|
780 |
-
border: none !important;
|
781 |
-
border-top: 1px dashed var(--custom-border-color) !important;
|
782 |
-
margin: 1rem 0 !important;
|
783 |
-
}}
|
784 |
-
.error-message {{
|
785 |
-
background-color: var(--custom-error-bg) !important;
|
786 |
-
border: 2px solid var(--custom-error-border) !important;
|
787 |
-
color: var(--custom-error-text) !important;
|
788 |
-
padding: 1.25rem !important;
|
789 |
-
border-radius: 8px !important;
|
790 |
-
display: flex !important;
|
791 |
-
align-items: flex-start !important;
|
792 |
-
gap: 0.8rem !important;
|
793 |
-
font-size: 0.95rem !important;
|
794 |
-
font-weight: 500 !important;
|
795 |
-
line-height: 1.6 !important;
|
796 |
-
text-align: left !important;
|
797 |
-
width: 100%;
|
798 |
-
box-sizing: border-box;
|
799 |
-
}}
|
800 |
-
.error-message a {{
|
801 |
-
color: var(--custom-error-text) !important;
|
802 |
-
text-decoration: underline !important;
|
803 |
-
}}
|
804 |
-
.error-icon {{
|
805 |
-
font-size: 1.4rem !important;
|
806 |
-
line-height: 1 !important;
|
807 |
-
margin-top: 0.1rem !important;
|
808 |
-
}}
|
809 |
-
.error-details {{
|
810 |
-
font-size: 0.85rem !important;
|
811 |
-
color: var(--custom-error-text) !important;
|
812 |
-
margin-top: 0.5rem !important;
|
813 |
-
opacity: 0.8;
|
814 |
}}
|
|
|
|
|
815 |
.placeholder {{
|
816 |
background-color: var(--custom-background-primary) !important;
|
817 |
border: 2px dashed var(--custom-border-color) !important;
|
818 |
-
border-radius: 8px !important;
|
819 |
-
padding: 2.5rem 1.5rem !important;
|
820 |
-
text-align: center !important;
|
821 |
color: var(--custom-text-secondary) !important;
|
822 |
-
font-style: italic !important;
|
823 |
-
font-size: 1.1rem !important;
|
824 |
-
width: 100%;
|
825 |
-
box-sizing: border-box;
|
826 |
}}
|
|
|
|
|
827 |
.examples-section .gr-samples-table {{
|
828 |
border: 2px solid var(--custom-border-color) !important;
|
829 |
-
|
830 |
-
overflow: hidden !important;
|
831 |
-
margin-top: 1rem !important;
|
832 |
-
}}
|
833 |
-
.examples-section .gr-samples-table th,
|
834 |
-
.examples-section .gr-samples-table td {{
|
835 |
-
padding: 0.9rem !important;
|
836 |
-
border: none !important;
|
837 |
-
font-size: 0.95rem !important;
|
838 |
-
text-align: left !important;
|
839 |
color: var(--custom-text-primary) !important;
|
840 |
}}
|
841 |
.examples-section .gr-samples-table th {{
|
842 |
background-color: var(--custom-background-secondary) !important;
|
843 |
-
font-weight: 700 !important;
|
844 |
color: var(--custom-text-primary) !important;
|
|
|
845 |
}}
|
846 |
.examples-section .gr-samples-table td {{
|
847 |
background-color: var(--custom-background-primary) !important;
|
848 |
color: var(--custom-text-primary) !important;
|
849 |
border-top: 1px solid var(--custom-border-color) !important;
|
850 |
-
cursor: pointer !important;
|
851 |
-
transition: background 0.2s ease, transform 0.1s ease !important;
|
852 |
}}
|
853 |
.examples-section .gr-samples-table tr:hover td {{
|
854 |
background-color: var(--custom-background-secondary) !important;
|
855 |
transform: translateX(5px);
|
856 |
}}
|
857 |
-
.gr-examples .gr-
|
858 |
-
|
859 |
-
|
860 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
861 |
}}
|
|
|
|
|
862 |
.app-footer-wrapper {{
|
863 |
background: linear-gradient(145deg, var(--custom-background-primary) 0%, var(--custom-background-secondary) 100%) !important;
|
864 |
border: 2px solid var(--custom-border-color) !important;
|
865 |
-
border-radius: 12px !important;
|
866 |
-
padding: 1.75rem !important;
|
867 |
-
margin-top: 1.5rem !important;
|
868 |
-
margin-bottom: 1.5rem !important;
|
869 |
-
text-align: center !important;
|
870 |
color: var(--custom-text-primary) !important;
|
871 |
}}
|
872 |
.app-footer p {{
|
873 |
-
margin: 0 !important;
|
874 |
-
max-width: 90% !important;
|
875 |
-
font-size: 0.95rem !important;
|
876 |
color: var(--custom-text-secondary) !important;
|
877 |
-
line-height: 1.6 !important;
|
878 |
-
background-color: transparent !important;
|
879 |
-
text-align: center !important;
|
880 |
-
white-space: normal !important;
|
881 |
}}
|
882 |
.app-footer strong, .app-footer b {{
|
883 |
-
font-weight: 700 !important;
|
884 |
color: var(--custom-primary-color) !important;
|
885 |
}}
|
886 |
.app-footer a {{
|
887 |
color: var(--custom-primary-color) !important;
|
888 |
-
text-decoration: underline !important;
|
889 |
-
font-weight: 600 !important;
|
890 |
}}
|
891 |
-
|
892 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
893 |
}}
|
894 |
|
895 |
-
/*
|
896 |
@media (max-width: 768px) {{
|
897 |
.gradio-container {{
|
898 |
padding: 1rem !important;
|
@@ -933,17 +618,15 @@ Answer:"""
|
|
933 |
}}
|
934 |
"""
|
935 |
|
936 |
-
# Removed theme_mode to avoid the TypeError
|
937 |
with gr.Blocks(css=custom_css, title="Landlord-Tenant Rights Assistant") as demo:
|
938 |
with gr.Group(elem_classes="app-header-wrapper"):
|
939 |
-
# The text-align and margin: auto rules in CSS will handle centering.
|
940 |
gr.Markdown(
|
941 |
"""
|
942 |
<span class='app-header-logo'>⚖️</span>
|
943 |
<h1 class='app-header-title'>Landlord-Tenant Rights Assistant</h1>
|
944 |
<p class='app-header-tagline'>Empowering You with State-Specific Legal Insights</p>
|
945 |
-
"""
|
946 |
-
|
947 |
)
|
948 |
|
949 |
with gr.Column(elem_classes="main-dashboard-container"):
|
@@ -1025,6 +708,19 @@ Answer:"""
|
|
1025 |
with gr.Group(elem_classes="app-footer-wrapper"):
|
1026 |
gr.Markdown(
|
1027 |
f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1028 |
<p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. For specific legal guidance, always consult with a licensed attorney in your jurisdiction.</p>
|
1029 |
<p>Developed by <strong>Nischal Subedi</strong>. Connect on <a href="https://www.linkedin.com/in/nischal1/" target="_blank" class="custom-link">LinkedIn</a> or explore insights at <a href="https://datascientistinsights.substack.com/" target="_blank" class="custom-link">Substack</a>.</p>
|
1030 |
"""
|
|
|
295 |
else: # If states failed to load, provide a generic example (e.g., California)
|
296 |
example_queries.append(["What basic rights do tenants have?", "California"])
|
297 |
|
|
|
298 |
custom_css = f"""
|
299 |
/* Import legible fonts from Google Fonts */
|
300 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@600;700;800&display=swap');
|
|
|
318 |
}}
|
319 |
|
320 |
/* CRITICAL: FORCE GRADIO'S INTERNAL VARIABLES TO OUR CUSTOM LIGHT THEME VALUES */
|
|
|
321 |
:root, html.dark, body.dark, .dark {{
|
322 |
/* General backgrounds */
|
323 |
--background-fill-primary: var(--custom-background-primary) !important;
|
|
|
379 |
--color-error-background: var(--custom-error-bg) !important;
|
380 |
--color-error-border: var(--custom-error-border) !important;
|
381 |
|
382 |
+
/* Specific overrides for common Gradio components */
|
383 |
--block-border-color: var(--custom-border-color) !important;
|
384 |
--input-border-color: var(--custom-border-color) !important;
|
385 |
--input-label-color: var(--custom-text-primary) !important;
|
386 |
--link-text-color: var(--custom-primary-color) !important;
|
387 |
--link-text-color-hover: var(--custom-primary-hover) !important;
|
388 |
+
|
389 |
+
/* Scrollbar */
|
390 |
--scrollbar-thumb-color: var(--custom-border-color) !important;
|
391 |
--scrollbar-track-color: var(--custom-background-secondary) !important;
|
392 |
}}
|
393 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
/* Base styles for html and body */
|
395 |
body, html {{
|
396 |
background-color: var(--custom-background-secondary) !important;
|
397 |
color: var(--custom-text-primary) !important;
|
398 |
+
transition: none !important;
|
399 |
}}
|
400 |
|
401 |
+
/* Target the main Gradio application container */
|
402 |
.gradio-app {{
|
403 |
background-color: var(--custom-background-secondary) !important;
|
404 |
color: var(--custom-text-primary) !important;
|
405 |
}}
|
406 |
|
407 |
/* Ensure all core Gradio blocks and components use our defined colors */
|
408 |
+
.gr-block, .gr-box, .gr-panel, .gr-form, .gr-columns, .gr-column,
|
409 |
+
.gradio-html, .gradio-markdown, .gradio-prose {{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
background-color: var(--custom-background-primary) !important;
|
|
|
411 |
color: var(--custom-text-primary) !important;
|
412 |
+
border-color: var(--custom-border-color) !important;
|
413 |
+
--text-color-body: var(--custom-text-primary) !important;
|
414 |
+
--text-color-subdued: var(--custom-text-secondary) !important;
|
415 |
}}
|
416 |
|
417 |
+
/* Centering styles for title and headers */
|
418 |
+
.app-header-title, .section-title {{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
text-align: center !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
420 |
width: 100% !important;
|
421 |
+
margin: 0 auto !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
}}
|
423 |
+
|
424 |
+
.app-header-wrapper, .dashboard-card-section {{
|
425 |
+
display: flex;
|
426 |
+
justify-content: center;
|
427 |
+
align-items: center;
|
428 |
+
flex-direction: column;
|
429 |
}}
|
430 |
|
431 |
+
/* Specific overrides for input fields */
|
432 |
.gradio-textbox textarea,
|
433 |
+
.gradio-textbox input {{
|
|
|
|
|
434 |
background-color: var(--custom-background-primary) !important;
|
435 |
color: var(--custom-text-primary) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
border: 2px solid var(--custom-border-color) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
box-shadow: var(--custom-shadow-sm) !important;
|
438 |
}}
|
|
|
|
|
|
|
439 |
.gradio-textbox textarea:focus,
|
440 |
.gradio-textbox input:focus {{
|
|
|
441 |
border-color: var(--custom-border-focus) !important;
|
442 |
box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.2) !important;
|
443 |
+
outline: none !important;
|
444 |
}}
|
445 |
+
|
446 |
+
/* Specific overrides for radio buttons */
|
|
|
|
|
|
|
|
|
|
|
447 |
.gradio-radio label {{
|
448 |
+
background-color: var(--custom-background-primary) !important;
|
|
|
|
|
|
|
|
|
|
|
449 |
color: var(--custom-text-primary) !important;
|
450 |
+
border: 2px solid var(--custom-border-color) !important;
|
|
|
|
|
451 |
box-shadow: var(--custom-shadow-sm) !important;
|
|
|
|
|
|
|
452 |
}}
|
453 |
.gradio-radio label span.text-lg {{
|
|
|
454 |
color: var(--custom-text-primary) !important;
|
|
|
455 |
}}
|
456 |
.gradio-radio label:hover {{
|
457 |
background-color: var(--custom-background-secondary) !important;
|
|
|
461 |
}}
|
462 |
.gradio-radio input[type="radio"]:checked + label {{
|
463 |
background-color: var(--custom-primary-color) !important;
|
464 |
+
color: white !important;
|
465 |
border-color: var(--custom-primary-hover) !important;
|
466 |
box-shadow: var(--custom-shadow-md) !important;
|
|
|
467 |
}}
|
468 |
.gradio-radio input[type="radio"]:checked + label span.text-lg {{
|
469 |
+
color: white !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
}}
|
471 |
+
|
472 |
+
/* Overrides for buttons */
|
473 |
.gr-button-primary {{
|
474 |
background-color: var(--custom-primary-color) !important;
|
475 |
+
color: white !important;
|
|
|
476 |
}}
|
477 |
.gr-button-primary:hover {{
|
478 |
background-color: var(--custom-primary-hover) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
}}
|
480 |
.gr-button-secondary {{
|
481 |
background-color: transparent !important;
|
|
|
485 |
.gr-button-secondary:hover {{
|
486 |
background-color: var(--custom-background-secondary) !important;
|
487 |
border-color: var(--custom-primary-color) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
}}
|
489 |
+
|
490 |
+
/* Placeholders */
|
491 |
.placeholder {{
|
492 |
background-color: var(--custom-background-primary) !important;
|
493 |
border: 2px dashed var(--custom-border-color) !important;
|
|
|
|
|
|
|
494 |
color: var(--custom-text-secondary) !important;
|
|
|
|
|
|
|
|
|
495 |
}}
|
496 |
+
|
497 |
+
/* Example table */
|
498 |
.examples-section .gr-samples-table {{
|
499 |
border: 2px solid var(--custom-border-color) !important;
|
500 |
+
background-color: var(--custom-background-primary) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
color: var(--custom-text-primary) !important;
|
502 |
}}
|
503 |
.examples-section .gr-samples-table th {{
|
504 |
background-color: var(--custom-background-secondary) !important;
|
|
|
505 |
color: var(--custom-text-primary) !important;
|
506 |
+
text-align: center !important; /* Center table headers */
|
507 |
}}
|
508 |
.examples-section .gr-samples-table td {{
|
509 |
background-color: var(--custom-background-primary) !important;
|
510 |
color: var(--custom-text-primary) !important;
|
511 |
border-top: 1px solid var(--custom-border-color) !important;
|
|
|
|
|
512 |
}}
|
513 |
.examples-section .gr-samples-table tr:hover td {{
|
514 |
background-color: var(--custom-background-secondary) !important;
|
515 |
transform: translateX(5px);
|
516 |
}}
|
517 |
+
.examples-section .gr-samples-table th, .examples-section .gr-samples-table td {{
|
518 |
+
border-color: var(--custom-border-color) !important;
|
519 |
+
}}
|
520 |
+
|
521 |
+
/* Error messages */
|
522 |
+
.error-message {{
|
523 |
+
background-color: var(--custom-error-bg) !important;
|
524 |
+
border: 2px solid var(--custom-error-border) !important;
|
525 |
+
color: var(--custom-error-text) !important;
|
526 |
+
}}
|
527 |
+
.error-message a {{
|
528 |
+
color: var(--custom-error-text) !important;
|
529 |
}}
|
530 |
+
|
531 |
+
/* Footer */
|
532 |
.app-footer-wrapper {{
|
533 |
background: linear-gradient(145deg, var(--custom-background-primary) 0%, var(--custom-background-secondary) 100%) !important;
|
534 |
border: 2px solid var(--custom-border-color) !important;
|
|
|
|
|
|
|
|
|
|
|
535 |
color: var(--custom-text-primary) !important;
|
536 |
}}
|
537 |
.app-footer p {{
|
|
|
|
|
|
|
538 |
color: var(--custom-text-secondary) !important;
|
|
|
|
|
|
|
|
|
539 |
}}
|
540 |
.app-footer strong, .app-footer b {{
|
|
|
541 |
color: var(--custom-primary-color) !important;
|
542 |
}}
|
543 |
.app-footer a {{
|
544 |
color: var(--custom-primary-color) !important;
|
|
|
|
|
545 |
}}
|
546 |
+
|
547 |
+
/* General element classes */
|
548 |
+
.gr-text, .gr-label, .gr-checkbox-group, .gr-radio-group,
|
549 |
+
.gr-slider, .gr-number, .gr-dropdown {{
|
550 |
+
color: var(--custom-text-primary) !important;
|
551 |
+
}}
|
552 |
+
|
553 |
+
/* Ensure all text within any Gradio element defaults to primary text color */
|
554 |
+
.gradio-container * {{
|
555 |
+
color: var(--custom-text-primary) !important;
|
556 |
+
}}
|
557 |
+
/* Re-override for specific cases that need secondary text color */
|
558 |
+
.gradio-container .gr-prose,
|
559 |
+
.gradio-container .app-header-tagline,
|
560 |
+
.gradio-container .placeholder,
|
561 |
+
.gradio-container .app-footer p {{
|
562 |
+
color: var(--custom-text-secondary) !important;
|
563 |
+
}}
|
564 |
+
/* Re-override for primary color elements */
|
565 |
+
.gradio-container .app-header-logo,
|
566 |
+
.gradio-container .response-header,
|
567 |
+
.gradio-container .response-icon,
|
568 |
+
.gradio-container .custom-link {{
|
569 |
+
color: var(--custom-primary-color) !important;
|
570 |
+
}}
|
571 |
+
.gradio-container .gr-button-primary {{
|
572 |
+
color: white !important;
|
573 |
+
}}
|
574 |
+
/* Ensure inputs specifically use primary text color */
|
575 |
+
.gradio-textbox textarea, .gradio-textbox input,
|
576 |
+
.gradio-radio label span.text-lg {{
|
577 |
+
color: var(--custom-text-primary) !important;
|
578 |
}}
|
579 |
|
580 |
+
/* Media Queries */
|
581 |
@media (max-width: 768px) {{
|
582 |
.gradio-container {{
|
583 |
padding: 1rem !important;
|
|
|
618 |
}}
|
619 |
"""
|
620 |
|
|
|
621 |
with gr.Blocks(css=custom_css, title="Landlord-Tenant Rights Assistant") as demo:
|
622 |
with gr.Group(elem_classes="app-header-wrapper"):
|
|
|
623 |
gr.Markdown(
|
624 |
"""
|
625 |
<span class='app-header-logo'>⚖️</span>
|
626 |
<h1 class='app-header-title'>Landlord-Tenant Rights Assistant</h1>
|
627 |
<p class='app-header-tagline'>Empowering You with State-Specific Legal Insights</p>
|
628 |
+
""",
|
629 |
+
elem_classes="full-width-center"
|
630 |
)
|
631 |
|
632 |
with gr.Column(elem_classes="main-dashboard-container"):
|
|
|
708 |
with gr.Group(elem_classes="app-footer-wrapper"):
|
709 |
gr.Markdown(
|
710 |
f"""
|
711 |
+
<style>
|
712 |
+
.custom-link {{
|
713 |
+
font-weight: bold !important;
|
714 |
+
color: var(--custom-primary-color) !important;
|
715 |
+
text-decoration: underline;
|
716 |
+
}}
|
717 |
+
.app-footer p {{
|
718 |
+
color: var(--custom-text-secondary) !important;
|
719 |
+
}}
|
720 |
+
.app-footer strong, .app-footer b {{
|
721 |
+
color: var(--custom-primary-color) !important;
|
722 |
+
}}
|
723 |
+
</style>
|
724 |
<p><strong>Disclaimer:</strong> This tool is for informational purposes only and does not constitute legal advice. For specific legal guidance, always consult with a licensed attorney in your jurisdiction.</p>
|
725 |
<p>Developed by <strong>Nischal Subedi</strong>. Connect on <a href="https://www.linkedin.com/in/nischal1/" target="_blank" class="custom-link">LinkedIn</a> or explore insights at <a href="https://datascientistinsights.substack.com/" target="_blank" class="custom-link">Substack</a>.</p>
|
726 |
"""
|