Spaces:
Sleeping
Sleeping
Alex Amari commited on
Commit ·
d77c610
1
Parent(s): 0c58f4d
Restyle app to match OHA branding
Browse files- __pycache__/app.cpython-312-pytest-7.4.4.pyc +0 -0
- app.py +112 -28
__pycache__/app.cpython-312-pytest-7.4.4.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-312-pytest-7.4.4.pyc and b/__pycache__/app.cpython-312-pytest-7.4.4.pyc differ
|
|
|
app.py
CHANGED
|
@@ -636,12 +636,17 @@ custom_css = """
|
|
| 636 |
/* --- Global --- */
|
| 637 |
.gradio-container {
|
| 638 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
|
| 639 |
-
max-width:
|
|
|
|
| 640 |
margin: 0 auto !important;
|
|
|
|
|
|
|
| 641 |
background: #FFFFFF !important;
|
| 642 |
color: #212529 !important;
|
| 643 |
font-size: 16px !important;
|
| 644 |
line-height: 1.6 !important;
|
|
|
|
|
|
|
| 645 |
}
|
| 646 |
|
| 647 |
/* --- CT.GOV Top Bar --- */
|
|
@@ -651,7 +656,15 @@ custom_css = """
|
|
| 651 |
font-size: 0.8rem;
|
| 652 |
padding: 6px 24px;
|
| 653 |
letter-spacing: 0.03em;
|
| 654 |
-
margin: -16px -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 655 |
}
|
| 656 |
.ct-gov-bar span {
|
| 657 |
opacity: 0.85;
|
|
@@ -662,7 +675,14 @@ custom_css = """
|
|
| 662 |
background: #003DA5;
|
| 663 |
color: #FFFFFF;
|
| 664 |
padding: 1.25rem 24px;
|
| 665 |
-
margin: 0 -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 666 |
}
|
| 667 |
.oha-header h1 {
|
| 668 |
color: #FFFFFF !important;
|
|
@@ -692,13 +712,12 @@ custom_css = """
|
|
| 692 |
vertical-align: middle;
|
| 693 |
}
|
| 694 |
|
| 695 |
-
/* --- Language Toggle --- */
|
| 696 |
-
.lang-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
color: #FFFFFF !important;
|
| 702 |
}
|
| 703 |
|
| 704 |
/* --- Section Cards / Groups --- */
|
|
@@ -709,6 +728,46 @@ custom_css = """
|
|
| 709 |
border: 1px solid #E0E0E0 !important;
|
| 710 |
box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
|
| 711 |
margin-bottom: 1rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 712 |
}
|
| 713 |
|
| 714 |
/* --- Headings --- */
|
|
@@ -872,6 +931,34 @@ hr {
|
|
| 872 |
border: 1px solid #E0E0E0 !important;
|
| 873 |
border-radius: 4px !important;
|
| 874 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 875 |
"""
|
| 876 |
|
| 877 |
# === GRADIO UI ===
|
|
@@ -903,35 +990,32 @@ def create_interface():
|
|
| 903 |
chat_history_state = gr.State([]) # List of {"role":..., "content":...} dicts
|
| 904 |
chat_count_state = gr.State(0) # Message counter for rate limiting
|
| 905 |
|
| 906 |
-
# CT.GOV top bar (decorative)
|
| 907 |
gr.HTML(
|
| 908 |
'<div class="ct-gov-bar">'
|
|
|
|
| 909 |
'<span><strong>CT.GOV</strong> | State of Connecticut</span>'
|
|
|
|
| 910 |
'</div>'
|
| 911 |
)
|
| 912 |
|
| 913 |
-
# OHA blue header band
|
| 914 |
gr.HTML(
|
| 915 |
'<div class="oha-header">'
|
| 916 |
-
'<
|
| 917 |
-
'<div>'
|
| 918 |
'<h1>Office of the Healthcare Advocate<span class="oha-beta">BETA</span></h1>'
|
| 919 |
'<div class="oha-subtitle">Hospital Financial Assistance Eligibility Screener</div>'
|
| 920 |
-
'</
|
| 921 |
-
'</div>'
|
| 922 |
'</div>'
|
| 923 |
)
|
| 924 |
|
| 925 |
-
with gr.Row():
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
label="Language",
|
| 933 |
-
container=False
|
| 934 |
-
)
|
| 935 |
|
| 936 |
# Step 1: Choose path
|
| 937 |
step1 = gr.Group(visible=True)
|
|
@@ -988,14 +1072,14 @@ def create_interface():
|
|
| 988 |
# Step 4: Results (with streaming) + follow-up chat
|
| 989 |
step4 = gr.Group(visible=False)
|
| 990 |
with step4:
|
| 991 |
-
results_output = gr.Markdown()
|
| 992 |
with gr.Row():
|
| 993 |
restart_btn = gr.Button("Check Another Hospital", variant="secondary")
|
| 994 |
download_btn = gr.Button("Download Results", variant="secondary")
|
| 995 |
download_file = gr.File(visible=False, label="Download")
|
| 996 |
|
| 997 |
# --- Follow-up chat section ---
|
| 998 |
-
gr.
|
| 999 |
gr.Markdown("### Follow-Up Questions")
|
| 1000 |
gr.Markdown("Have additional questions? Ask about eligibility, the application process, required documents, or appeal rights.")
|
| 1001 |
|
|
|
|
| 636 |
/* --- Global --- */
|
| 637 |
.gradio-container {
|
| 638 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
|
| 639 |
+
max-width: 900px !important;
|
| 640 |
+
width: 100% !important;
|
| 641 |
margin: 0 auto !important;
|
| 642 |
+
padding-left: 1rem !important;
|
| 643 |
+
padding-right: 1rem !important;
|
| 644 |
background: #FFFFFF !important;
|
| 645 |
color: #212529 !important;
|
| 646 |
font-size: 16px !important;
|
| 647 |
line-height: 1.6 !important;
|
| 648 |
+
min-width: 320px !important;
|
| 649 |
+
box-sizing: border-box !important;
|
| 650 |
}
|
| 651 |
|
| 652 |
/* --- CT.GOV Top Bar --- */
|
|
|
|
| 656 |
font-size: 0.8rem;
|
| 657 |
padding: 6px 24px;
|
| 658 |
letter-spacing: 0.03em;
|
| 659 |
+
margin: -16px -1rem 0 -1rem;
|
| 660 |
+
}
|
| 661 |
+
.ct-gov-bar a {
|
| 662 |
+
color: #FFFFFF !important;
|
| 663 |
+
text-decoration: none;
|
| 664 |
+
}
|
| 665 |
+
.ct-gov-bar a:hover {
|
| 666 |
+
text-decoration: underline;
|
| 667 |
+
color: #FFFFFF !important;
|
| 668 |
}
|
| 669 |
.ct-gov-bar span {
|
| 670 |
opacity: 0.85;
|
|
|
|
| 675 |
background: #003DA5;
|
| 676 |
color: #FFFFFF;
|
| 677 |
padding: 1.25rem 24px;
|
| 678 |
+
margin: 0 -1rem 1rem -1rem;
|
| 679 |
+
}
|
| 680 |
+
.oha-header a {
|
| 681 |
+
color: #FFFFFF !important;
|
| 682 |
+
text-decoration: none;
|
| 683 |
+
}
|
| 684 |
+
.oha-header a:hover {
|
| 685 |
+
opacity: 0.9;
|
| 686 |
}
|
| 687 |
.oha-header h1 {
|
| 688 |
color: #FFFFFF !important;
|
|
|
|
| 712 |
vertical-align: middle;
|
| 713 |
}
|
| 714 |
|
| 715 |
+
/* --- Language Toggle Row --- */
|
| 716 |
+
.lang-row {
|
| 717 |
+
justify-content: flex-end !important;
|
| 718 |
+
margin-bottom: 0.5rem !important;
|
| 719 |
+
min-height: 0 !important;
|
| 720 |
+
gap: 0 !important;
|
|
|
|
| 721 |
}
|
| 722 |
|
| 723 |
/* --- Section Cards / Groups --- */
|
|
|
|
| 728 |
border: 1px solid #E0E0E0 !important;
|
| 729 |
box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
|
| 730 |
margin-bottom: 1rem !important;
|
| 731 |
+
width: 100% !important;
|
| 732 |
+
box-sizing: border-box !important;
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
/* --- Prevent streaming reflow --- */
|
| 736 |
+
.results-area {
|
| 737 |
+
width: 100% !important;
|
| 738 |
+
min-height: 400px;
|
| 739 |
+
box-sizing: border-box !important;
|
| 740 |
+
}
|
| 741 |
+
.results-area .prose {
|
| 742 |
+
overflow-wrap: break-word;
|
| 743 |
+
word-break: break-word;
|
| 744 |
+
}
|
| 745 |
+
|
| 746 |
+
/* --- Collapse empty Gradio wrappers --- */
|
| 747 |
+
.gr-group:empty,
|
| 748 |
+
.gr-block:empty,
|
| 749 |
+
.gr-box:empty,
|
| 750 |
+
.gr-padded:empty {
|
| 751 |
+
padding: 0 !important;
|
| 752 |
+
margin: 0 !important;
|
| 753 |
+
min-height: 0 !important;
|
| 754 |
+
border: none !important;
|
| 755 |
+
box-shadow: none !important;
|
| 756 |
+
}
|
| 757 |
+
/* Hide Markdown components that have no visible text */
|
| 758 |
+
.empty-md, .empty-md * {
|
| 759 |
+
padding: 0 !important;
|
| 760 |
+
margin: 0 !important;
|
| 761 |
+
min-height: 0 !important;
|
| 762 |
+
font-size: 0 !important;
|
| 763 |
+
line-height: 0 !important;
|
| 764 |
+
border: none !important;
|
| 765 |
+
}
|
| 766 |
+
/* Chat separator uses HR inside markdown — collapse its wrapper padding */
|
| 767 |
+
.chat-divider {
|
| 768 |
+
margin: 0.5rem 0 !important;
|
| 769 |
+
padding: 0 !important;
|
| 770 |
+
min-height: 0 !important;
|
| 771 |
}
|
| 772 |
|
| 773 |
/* --- Headings --- */
|
|
|
|
| 931 |
border: 1px solid #E0E0E0 !important;
|
| 932 |
border-radius: 4px !important;
|
| 933 |
}
|
| 934 |
+
|
| 935 |
+
/* --- Mobile Responsive --- */
|
| 936 |
+
@media (max-width: 640px) {
|
| 937 |
+
.gradio-container {
|
| 938 |
+
padding-left: 0.5rem !important;
|
| 939 |
+
padding-right: 0.5rem !important;
|
| 940 |
+
}
|
| 941 |
+
.ct-gov-bar {
|
| 942 |
+
padding: 6px 12px;
|
| 943 |
+
margin-left: -0.5rem;
|
| 944 |
+
margin-right: -0.5rem;
|
| 945 |
+
}
|
| 946 |
+
.oha-header {
|
| 947 |
+
padding: 1rem 12px;
|
| 948 |
+
margin-left: -0.5rem;
|
| 949 |
+
margin-right: -0.5rem;
|
| 950 |
+
}
|
| 951 |
+
.oha-header h1 {
|
| 952 |
+
font-size: 1.35rem !important;
|
| 953 |
+
}
|
| 954 |
+
.gr-group {
|
| 955 |
+
padding: 1rem !important;
|
| 956 |
+
}
|
| 957 |
+
.prompt-pill button {
|
| 958 |
+
font-size: 0.78rem !important;
|
| 959 |
+
padding: 0.35rem 0.75rem !important;
|
| 960 |
+
}
|
| 961 |
+
}
|
| 962 |
"""
|
| 963 |
|
| 964 |
# === GRADIO UI ===
|
|
|
|
| 990 |
chat_history_state = gr.State([]) # List of {"role":..., "content":...} dicts
|
| 991 |
chat_count_state = gr.State(0) # Message counter for rate limiting
|
| 992 |
|
| 993 |
+
# CT.GOV top bar (decorative, links to ct.gov)
|
| 994 |
gr.HTML(
|
| 995 |
'<div class="ct-gov-bar">'
|
| 996 |
+
'<a href="https://portal.ct.gov" target="_blank" rel="noopener">'
|
| 997 |
'<span><strong>CT.GOV</strong> | State of Connecticut</span>'
|
| 998 |
+
'</a>'
|
| 999 |
'</div>'
|
| 1000 |
)
|
| 1001 |
|
| 1002 |
+
# OHA blue header band (links to OHA homepage)
|
| 1003 |
gr.HTML(
|
| 1004 |
'<div class="oha-header">'
|
| 1005 |
+
'<a href="https://portal.ct.gov/oha" target="_blank" rel="noopener">'
|
|
|
|
| 1006 |
'<h1>Office of the Healthcare Advocate<span class="oha-beta">BETA</span></h1>'
|
| 1007 |
'<div class="oha-subtitle">Hospital Financial Assistance Eligibility Screener</div>'
|
| 1008 |
+
'</a>'
|
|
|
|
| 1009 |
'</div>'
|
| 1010 |
)
|
| 1011 |
|
| 1012 |
+
with gr.Row(elem_classes="lang-row"):
|
| 1013 |
+
lang_toggle = gr.Radio(
|
| 1014 |
+
choices=["English", "Espa\u00f1ol"],
|
| 1015 |
+
value="English",
|
| 1016 |
+
label="Language",
|
| 1017 |
+
container=False
|
| 1018 |
+
)
|
|
|
|
|
|
|
|
|
|
| 1019 |
|
| 1020 |
# Step 1: Choose path
|
| 1021 |
step1 = gr.Group(visible=True)
|
|
|
|
| 1072 |
# Step 4: Results (with streaming) + follow-up chat
|
| 1073 |
step4 = gr.Group(visible=False)
|
| 1074 |
with step4:
|
| 1075 |
+
results_output = gr.Markdown(elem_classes="results-area")
|
| 1076 |
with gr.Row():
|
| 1077 |
restart_btn = gr.Button("Check Another Hospital", variant="secondary")
|
| 1078 |
download_btn = gr.Button("Download Results", variant="secondary")
|
| 1079 |
download_file = gr.File(visible=False, label="Download")
|
| 1080 |
|
| 1081 |
# --- Follow-up chat section ---
|
| 1082 |
+
gr.HTML('<hr style="border:none; border-top:1px solid #E0E0E0; margin:1.5rem 0 1rem 0;">')
|
| 1083 |
gr.Markdown("### Follow-Up Questions")
|
| 1084 |
gr.Markdown("Have additional questions? Ask about eligibility, the application process, required documents, or appeal rights.")
|
| 1085 |
|