Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- src/chatbot/app.py +83 -97
src/chatbot/app.py
CHANGED
|
@@ -58,143 +58,129 @@ session = st.session_state.ai_session
|
|
| 58 |
# -----------------------------
|
| 59 |
st.markdown("""
|
| 60 |
<style>
|
| 61 |
-
/*
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
-
.
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
padding-bottom: 2rem !important;
|
| 71 |
}
|
| 72 |
|
| 73 |
-
/*
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
z-index: 100 !important; /* Ensure it stays clickable but transparent */
|
| 77 |
-
}
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
-
/*
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
-
|
| 90 |
-
/* Hero
|
| 91 |
.hero-container {
|
| 92 |
-
position: relative;
|
| 93 |
-
width: 100vw;
|
| 94 |
-
left: 50%;
|
| 95 |
-
right: 50%;
|
| 96 |
-
margin-left: -50vw;
|
| 97 |
-
margin-right: -50vw;
|
| 98 |
-
margin-top: -6rem; /* Pull up to cover top padding */
|
| 99 |
-
padding: 4rem 1rem 2rem 1rem; /* Extra top padding for status bar area */
|
| 100 |
-
text-align: center;
|
| 101 |
-
margin-bottom: 2rem;
|
| 102 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 103 |
color: white;
|
|
|
|
|
|
|
| 104 |
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
|
|
|
| 105 |
}
|
| 106 |
|
| 107 |
.hero-title {
|
| 108 |
-
font-size: 2rem;
|
| 109 |
-
margin-bottom: 0.5rem;
|
| 110 |
font-weight: 700;
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
.hero-subtitle {
|
| 113 |
font-size: 1rem;
|
| 114 |
opacity: 0.95;
|
| 115 |
font-weight: 400;
|
|
|
|
| 116 |
}
|
| 117 |
|
| 118 |
-
/*
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
}
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
.stChatMessage {
|
| 126 |
background-color: white;
|
| 127 |
border-radius: 12px;
|
|
|
|
|
|
|
| 128 |
padding: 1rem;
|
| 129 |
-
margin-bottom: 0.75rem;
|
| 130 |
-
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
| 131 |
-
border: 1px solid #f0f0f0;
|
| 132 |
}
|
| 133 |
|
| 134 |
.stChatMessage[data-testid="stChatMessage"]:nth-of-type(odd) {
|
| 135 |
-
background-color: #f8f9fa;
|
| 136 |
}
|
| 137 |
|
| 138 |
-
/*
|
| 139 |
-
.
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
}
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
|
|
|
|
|
|
| 148 |
}
|
| 149 |
|
| 150 |
-
/* Sidebar
|
| 151 |
section[data-testid="stSidebar"] {
|
| 152 |
background-color: #ffffff;
|
| 153 |
border-right: 1px solid #eaeaea;
|
| 154 |
}
|
| 155 |
-
|
| 156 |
-
.suggestion-btn {
|
| 157 |
-
width: 100%;
|
| 158 |
-
text-align: left;
|
| 159 |
-
padding: 0.75rem 1rem;
|
| 160 |
-
margin-bottom: 0.5rem;
|
| 161 |
-
background-color: #f8f9fa;
|
| 162 |
-
border: 1px solid #e9ecef;
|
| 163 |
-
border-radius: 8px;
|
| 164 |
-
color: #495057;
|
| 165 |
-
font-size: 0.95rem;
|
| 166 |
-
transition: all 0.2s ease;
|
| 167 |
-
cursor: pointer;
|
| 168 |
-
display: block;
|
| 169 |
-
text-decoration: none;
|
| 170 |
-
}
|
| 171 |
-
.suggestion-btn:hover {
|
| 172 |
-
background-color: #e2e6ea;
|
| 173 |
-
border-color: #dae0e5;
|
| 174 |
-
text-decoration: none;
|
| 175 |
-
color: #212529;
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
/* Mobile Responsiveness Fixes */
|
| 179 |
-
@media (max-width: 768px) {
|
| 180 |
-
.block-container {
|
| 181 |
-
padding-left: 1rem !important;
|
| 182 |
-
padding-right: 1rem !important;
|
| 183 |
-
}
|
| 184 |
-
.hero-title {
|
| 185 |
-
font-size: 1.5rem;
|
| 186 |
-
}
|
| 187 |
-
.stChatMessage {
|
| 188 |
-
padding: 0.75rem;
|
| 189 |
-
}
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
/* Button accessibility */
|
| 193 |
-
.stButton button {
|
| 194 |
-
min-height: 44px; /* ADA Minimum Touch Target */
|
| 195 |
-
border-radius: 8px;
|
| 196 |
-
}
|
| 197 |
-
|
| 198 |
</style>
|
| 199 |
""", unsafe_allow_html=True)
|
| 200 |
|
|
|
|
| 58 |
# -----------------------------
|
| 59 |
st.markdown("""
|
| 60 |
<style>
|
| 61 |
+
/* ---------------------------------------------------------------------
|
| 62 |
+
1. GLOBAL & RESET
|
| 63 |
+
--------------------------------------------------------------------- */
|
| 64 |
+
* {
|
| 65 |
+
box-sizing: border-box;
|
| 66 |
}
|
| 67 |
|
| 68 |
+
.stApp, [data-testid="stAppViewContainer"] {
|
| 69 |
+
/* Standard Streamlit background */
|
| 70 |
+
background-color: #f8f9fa;
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
+
/* ---------------------------------------------------------------------
|
| 74 |
+
2. LAYOUT & HERO BANNER
|
| 75 |
+
--------------------------------------------------------------------- */
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
/* Desktop Layout */
|
| 78 |
+
@media (min-width: 769px) {
|
| 79 |
+
.block-container {
|
| 80 |
+
padding-top: 0 !important;
|
| 81 |
+
padding-bottom: 2rem !important;
|
| 82 |
+
padding-left: 5rem !important;
|
| 83 |
+
padding-right: 5rem !important;
|
| 84 |
+
max-width: 100% !important;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
.hero-container {
|
| 88 |
+
margin-top: 0;
|
| 89 |
+
margin-left: -5rem;
|
| 90 |
+
margin-right: -5rem;
|
| 91 |
+
/* Simple negative margins to pull edge-to-edge */
|
| 92 |
+
padding: 2.5rem 1rem 2rem 1rem; /* Compact desktop padding */
|
| 93 |
+
}
|
| 94 |
}
|
| 95 |
|
| 96 |
+
/* Mobile Layout */
|
| 97 |
+
@media (max-width: 768px) {
|
| 98 |
+
.block-container {
|
| 99 |
+
padding-left: 1rem !important;
|
| 100 |
+
padding-right: 1rem !important;
|
| 101 |
+
padding-top: 0 !important;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.hero-container {
|
| 105 |
+
margin-top: 0;
|
| 106 |
+
margin-left: -1rem;
|
| 107 |
+
margin-right: -1rem;
|
| 108 |
+
/* Break out of the 1rem padding */
|
| 109 |
+
padding: 2rem 1rem 1.5rem 1rem; /* Compact mobile padding */
|
| 110 |
+
border-radius: 0 0 12px 12px;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/* Ensure font sizes are standard (Streamlit defaults is ~16px) */
|
| 114 |
+
/* We DO NOT override them to 17px/fixed, allowing system zoom to work. */
|
| 115 |
}
|
| 116 |
+
|
| 117 |
+
/* Hero Styling */
|
| 118 |
.hero-container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 120 |
color: white;
|
| 121 |
+
text-align: center;
|
| 122 |
+
border-radius: 0 0 16px 16px;
|
| 123 |
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
| 124 |
+
margin-bottom: 2rem;
|
| 125 |
}
|
| 126 |
|
| 127 |
.hero-title {
|
| 128 |
+
font-size: 2rem; /* Slightly smaller */
|
|
|
|
| 129 |
font-weight: 700;
|
| 130 |
+
margin-bottom: 0.25rem;
|
| 131 |
+
color: white !important;
|
| 132 |
}
|
| 133 |
.hero-subtitle {
|
| 134 |
font-size: 1rem;
|
| 135 |
opacity: 0.95;
|
| 136 |
font-weight: 400;
|
| 137 |
+
color: rgba(255,255,255,0.95) !important;
|
| 138 |
}
|
| 139 |
|
| 140 |
+
/* Remove Header Decoration */
|
| 141 |
+
header[data-testid="stHeader"] {
|
| 142 |
+
background-color: transparent !important;
|
| 143 |
+
height: 0 !important;
|
| 144 |
+
z-index: 100;
|
| 145 |
}
|
| 146 |
+
div[data-testid="stDecoration"] { display: none; }
|
| 147 |
+
|
| 148 |
+
/* ---------------------------------------------------------------------
|
| 149 |
+
3. COMPONENT STYLING (Healthcare-like)
|
| 150 |
+
--------------------------------------------------------------------- */
|
| 151 |
+
|
| 152 |
+
/* Chat Bubbles - Clean & Readable */
|
| 153 |
.stChatMessage {
|
| 154 |
background-color: white;
|
| 155 |
border-radius: 12px;
|
| 156 |
+
border: 1px solid #e5e5e5;
|
| 157 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
|
| 158 |
padding: 1rem;
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
.stChatMessage[data-testid="stChatMessage"]:nth-of-type(odd) {
|
| 162 |
+
background-color: #f8f9fa;
|
| 163 |
}
|
| 164 |
|
| 165 |
+
/* Input Fields */
|
| 166 |
+
.stTextInput input {
|
| 167 |
+
border-radius: 20px; /* Matching healthcare-assistant roundness */
|
| 168 |
+
border: 1px solid #ddd;
|
| 169 |
+
padding: 0.75rem 1rem;
|
| 170 |
}
|
| 171 |
+
|
| 172 |
+
/* Buttons */
|
| 173 |
+
.stButton button {
|
| 174 |
+
border-radius: 20px; /* Matching healthcare-assistant */
|
| 175 |
+
min-height: 48px;
|
| 176 |
+
font-weight: 500;
|
| 177 |
}
|
| 178 |
|
| 179 |
+
/* Sidebar */
|
| 180 |
section[data-testid="stSidebar"] {
|
| 181 |
background-color: #ffffff;
|
| 182 |
border-right: 1px solid #eaeaea;
|
| 183 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
</style>
|
| 185 |
""", unsafe_allow_html=True)
|
| 186 |
|