Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1083,21 +1083,21 @@ def show_main_app():
|
|
| 1083 |
}
|
| 1084 |
# --- END QUOTE CATEGORIES DEFINITION ---
|
| 1085 |
|
| 1086 |
-
# --- ENHANCED CUSTOM CSS FOR MAIN APP (
|
| 1087 |
st.markdown("""
|
| 1088 |
<style>
|
| 1089 |
/* Global Styles & Background */
|
| 1090 |
.stApp {
|
| 1091 |
-
background: linear-gradient(to bottom right, #f8f9fa, #e9ecef);
|
| 1092 |
-
color: #343a40;
|
| 1093 |
-
font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
| 1094 |
-
-webkit-font-smoothing: antialiased;
|
| 1095 |
-
padding-top: 2rem;
|
| 1096 |
}
|
| 1097 |
|
| 1098 |
/* Streamlit's main block container for content centering and width */
|
| 1099 |
.main .block-container {
|
| 1100 |
-
max-width: 1200px;
|
| 1101 |
padding-top: 2rem;
|
| 1102 |
padding-bottom: 2rem;
|
| 1103 |
padding-left: 1rem;
|
|
@@ -1112,34 +1112,33 @@ def show_main_app():
|
|
| 1112 |
display: none;
|
| 1113 |
}
|
| 1114 |
|
| 1115 |
-
|
| 1116 |
/* Header & Titles */
|
| 1117 |
h1, h2, h3, h4, h5, h6 {
|
| 1118 |
-
color: #212529;
|
| 1119 |
-
margin-top: 1.8rem;
|
| 1120 |
-
margin-bottom: 0.9rem;
|
| 1121 |
font-weight: 700;
|
| 1122 |
}
|
| 1123 |
h1 {
|
| 1124 |
font-size: 2.8em;
|
| 1125 |
-
font-weight: 800;
|
| 1126 |
-
color: #5d6dbe;
|
| 1127 |
letter-spacing: -0.8px;
|
| 1128 |
-
text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
|
| 1129 |
}
|
| 1130 |
-
.header-tagline {
|
| 1131 |
font-size: 1.2em;
|
| 1132 |
-
color: #6c757d;
|
| 1133 |
-
margin-top: -0.5rem;
|
| 1134 |
-
margin-bottom: 2.5rem;
|
| 1135 |
font-weight: 400;
|
| 1136 |
}
|
| 1137 |
h2 {
|
| 1138 |
font-size: 2em;
|
| 1139 |
font-weight: 700;
|
| 1140 |
-
border-bottom: 2px solid #e9ecef;
|
| 1141 |
padding-bottom: 0.7rem;
|
| 1142 |
-
margin-bottom: 2rem;
|
| 1143 |
color: #343a40;
|
| 1144 |
}
|
| 1145 |
h3 {
|
|
@@ -1149,47 +1148,46 @@ def show_main_app():
|
|
| 1149 |
margin-top: 2rem;
|
| 1150 |
margin-bottom: 1.2rem;
|
| 1151 |
}
|
| 1152 |
-
h5 {
|
| 1153 |
font-size: 1.1em;
|
| 1154 |
font-weight: 600;
|
| 1155 |
color: #495057;
|
| 1156 |
margin-bottom: 1rem;
|
| 1157 |
}
|
| 1158 |
|
| 1159 |
-
|
| 1160 |
/* Metrics (Total Conversations, Most Common Emotion, Avg. Confidence) */
|
| 1161 |
[data-testid="stMetric"] {
|
| 1162 |
background-color: #ffffff;
|
| 1163 |
-
border: 1px solid #dee2e6;
|
| 1164 |
-
border-radius: 12px;
|
| 1165 |
-
padding: 20px;
|
| 1166 |
-
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
| 1167 |
text-align: center;
|
| 1168 |
-
margin-bottom: 1.5rem;
|
| 1169 |
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
| 1170 |
}
|
| 1171 |
[data-testid="stMetric"]:hover {
|
| 1172 |
-
transform: translateY(-5px);
|
| 1173 |
-
box-shadow: 0 12px 30px rgba(0,0,0,0.12);
|
| 1174 |
}
|
| 1175 |
[data-testid="stMetricLabel"] {
|
| 1176 |
-
font-size: 1em;
|
| 1177 |
color: #6c757d;
|
| 1178 |
-
margin-bottom: 8px;
|
| 1179 |
font-weight: 500;
|
| 1180 |
}
|
| 1181 |
[data-testid="stMetricValue"] {
|
| 1182 |
-
font-size: 2.8em;
|
| 1183 |
-
font-weight: 800;
|
| 1184 |
-
color: #5d6dbe;
|
| 1185 |
}
|
| 1186 |
|
| 1187 |
/* Buttons */
|
| 1188 |
.stButton>button {
|
| 1189 |
-
background-color: #5d6dbe;
|
| 1190 |
color: white;
|
| 1191 |
border: none;
|
| 1192 |
-
border-radius: 10px;
|
| 1193 |
padding: 12px 25px;
|
| 1194 |
font-size: 1.1em;
|
| 1195 |
font-weight: bold;
|
|
@@ -1199,8 +1197,8 @@ def show_main_app():
|
|
| 1199 |
letter-spacing: 0.5px;
|
| 1200 |
}
|
| 1201 |
.stButton>button:hover {
|
| 1202 |
-
background-color: #4a5c9d;
|
| 1203 |
-
transform: translateY(-3px);
|
| 1204 |
box-shadow: 0 8px 20px rgba(0,0,0,0.15);
|
| 1205 |
}
|
| 1206 |
.stButton>button:active {
|
|
@@ -1210,7 +1208,7 @@ def show_main_app():
|
|
| 1210 |
}
|
| 1211 |
/* Logout button specific style */
|
| 1212 |
[key="logout_btn"] > button {
|
| 1213 |
-
background-color: #dc3545;
|
| 1214 |
box-shadow: 0 5px 15px rgba(220,53,69,0.2);
|
| 1215 |
}
|
| 1216 |
[key="logout_btn"] > button:hover {
|
|
@@ -1223,116 +1221,110 @@ def show_main_app():
|
|
| 1223 |
.stTextInput>div>div>input, .stTextArea>div>div>textarea {
|
| 1224 |
border-radius: 10px;
|
| 1225 |
border: 1px solid #ced4da;
|
| 1226 |
-
padding: 14px 18px;
|
| 1227 |
font-size: 1.05em;
|
| 1228 |
color: #343a40;
|
| 1229 |
-
background-color: #fcfcfc;
|
| 1230 |
-
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
|
| 1231 |
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
| 1232 |
}
|
| 1233 |
.stTextInput>div>div>input:focus, .stTextArea>div>div>textarea:focus {
|
| 1234 |
-
border-color: #5d6dbe;
|
| 1235 |
-
box-shadow: 0 0 0 0.25rem rgba(93,109,190,0.25);
|
| 1236 |
outline: none;
|
| 1237 |
}
|
| 1238 |
.stTextInput>label, .stTextArea>label {
|
| 1239 |
font-weight: 600;
|
| 1240 |
color: #495057;
|
| 1241 |
-
margin-bottom: 0.6rem;
|
| 1242 |
}
|
| 1243 |
|
| 1244 |
-
/* Selectbox (Dropdown) */
|
| 1245 |
-
/* Target the main container for the selectbox */
|
| 1246 |
[data-testid="stSelectbox"] > div:first-child > div:first-child {
|
| 1247 |
border-radius: 10px;
|
| 1248 |
border: 1px solid #ced4da;
|
| 1249 |
background-color: #fcfcfc;
|
| 1250 |
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
|
| 1251 |
-
display: flex;
|
| 1252 |
-
align-items: center;
|
| 1253 |
-
min-height: 48px;
|
| 1254 |
-
padding: 0 10px;
|
| 1255 |
}
|
| 1256 |
.stSelectbox>label {
|
| 1257 |
font-weight: 600;
|
| 1258 |
color: #495057;
|
| 1259 |
margin-bottom: 0.6rem;
|
| 1260 |
}
|
| 1261 |
-
/*
|
| 1262 |
[data-testid="stSelectbox"] input[type="text"] {
|
| 1263 |
-
color: black !important;
|
| 1264 |
-
-webkit-text-fill-color: black !important; /* For Webkit browsers
|
| 1265 |
-
opacity: 1 !important;
|
| 1266 |
-
flex-grow: 1;
|
| 1267 |
-
padding: 12px 5px;
|
| 1268 |
-
font-size: 1.05em;
|
| 1269 |
-
line-height: 1.2em;
|
| 1270 |
-
min-height: 1.2em;
|
| 1271 |
-
background-color: transparent !important;
|
| 1272 |
-
border: none !important;
|
| 1273 |
-
outline: none !important;
|
| 1274 |
-
box-shadow: none !important;
|
| 1275 |
-
}
|
| 1276 |
-
|
| 1277 |
-
/* FIX: Dropdown arrow color and visibility */
|
| 1278 |
-
/* Target the button containing the SVG icon for the dropdown */
|
| 1279 |
[data-testid="stSelectbox"] button {
|
| 1280 |
-
background-color: transparent !important;
|
| 1281 |
-
border: none !important;
|
| 1282 |
-
padding: 0 5px;
|
| 1283 |
cursor: pointer;
|
| 1284 |
-
display: flex;
|
| 1285 |
align-items: center;
|
| 1286 |
justify-content: center;
|
| 1287 |
}
|
| 1288 |
-
/* Target the SVG icon itself */
|
| 1289 |
[data-testid="stSelectbox"] svg {
|
| 1290 |
-
fill: black !important;
|
| 1291 |
-
color: black !important;
|
| 1292 |
-
font-size: 1.5em !important;
|
| 1293 |
-
width: 1em !important;
|
| 1294 |
-
height: 1em !important;
|
| 1295 |
}
|
| 1296 |
-
/* Specific path inside SVG might also need fill */
|
| 1297 |
[data-testid="stSelectbox"] svg path {
|
| 1298 |
fill: black !important;
|
| 1299 |
}
|
| 1300 |
|
| 1301 |
|
| 1302 |
-
/* File Uploader */
|
| 1303 |
[data-testid="stFileUploaderDropzone"] {
|
| 1304 |
-
border-radius: 12px;
|
| 1305 |
border: 2px dashed #a0a8b4;
|
| 1306 |
-
background-color: #ffffff !important;
|
| 1307 |
-
padding: 25px;
|
| 1308 |
transition: border-color 0.3s ease, background-color 0.3s ease;
|
| 1309 |
margin-bottom: 1.5rem;
|
| 1310 |
-
display: flex;
|
| 1311 |
flex-direction: column;
|
| 1312 |
justify-content: center;
|
| 1313 |
align-items: center;
|
| 1314 |
text-align: center;
|
| 1315 |
min-height: 120px;
|
| 1316 |
-
overflow: hidden;
|
| 1317 |
}
|
| 1318 |
[data-testid="stFileUploaderDropzone"]:hover {
|
| 1319 |
-
border-color: #5d6dbe;
|
| 1320 |
background-color: #f7f9fb;
|
| 1321 |
}
|
| 1322 |
-
|
| 1323 |
-
/* FIX: File Uploader text color */
|
| 1324 |
-
/* Target all relevant text elements inside the file uploader dropzone */
|
| 1325 |
[data-testid="stFileUploaderDropzone"] *,
|
| 1326 |
[data-testid="stFileUploaderDropzone"] p,
|
| 1327 |
[data-testid="stFileUploaderDropzone"] span,
|
| 1328 |
[data-testid="stFileUploaderDropzone"] div {
|
| 1329 |
-
color: black !important;
|
| 1330 |
-
|
| 1331 |
-
|
| 1332 |
-
|
| 1333 |
-
|
|
|
|
| 1334 |
}
|
| 1335 |
-
/*
|
| 1336 |
[data-testid="stFileUploaderDropzone"] > div > div > div:nth-child(2) > div:first-child {
|
| 1337 |
color: black !important;
|
| 1338 |
}
|
|
@@ -1340,14 +1332,13 @@ def show_main_app():
|
|
| 1340 |
color: black !important;
|
| 1341 |
}
|
| 1342 |
|
| 1343 |
-
|
| 1344 |
[data-testid="stFileUploaderFileName"] {
|
| 1345 |
font-size: 0.95em;
|
| 1346 |
color: #495057;
|
| 1347 |
margin-top: 10px;
|
| 1348 |
-
word-break: break-all;
|
| 1349 |
}
|
| 1350 |
-
[data-testid="stFileUploaderFile"] {
|
| 1351 |
background-color: #e9ecef;
|
| 1352 |
border-radius: 8px;
|
| 1353 |
padding: 8px 12px;
|
|
@@ -1359,14 +1350,14 @@ def show_main_app():
|
|
| 1359 |
/* Information, Success, Error, Warning Boxes */
|
| 1360 |
[data-testid="stAlert"] {
|
| 1361 |
border-radius: 10px;
|
| 1362 |
-
padding: 18px 25px;
|
| 1363 |
-
margin-bottom: 1.8rem;
|
| 1364 |
-
font-size: 1.05em;
|
| 1365 |
line-height: 1.6;
|
| 1366 |
text-align: left;
|
| 1367 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 1368 |
}
|
| 1369 |
-
/*
|
| 1370 |
[data-testid="stAlert"] .streamlit-warning {
|
| 1371 |
background-color: #fef7e0; color: #7a5f00; border-left: 6px solid #ffcc00;
|
| 1372 |
}
|
|
@@ -1374,25 +1365,27 @@ def show_main_app():
|
|
| 1374 |
[data-testid="stAlert"] .streamlit-success {
|
| 1375 |
background-color: #e6ffe6;
|
| 1376 |
border-left: 6px solid #4CAF50;
|
| 1377 |
-
|
| 1378 |
-
color: black !important;
|
| 1379 |
}
|
| 1380 |
-
/*
|
| 1381 |
[data-testid="stAlert"] .streamlit-success p,
|
| 1382 |
[data-testid="stAlert"] .streamlit-success span,
|
| 1383 |
-
[data-testid="stAlert"] .streamlit-success div
|
|
|
|
| 1384 |
color: black !important;
|
|
|
|
|
|
|
| 1385 |
}
|
| 1386 |
|
|
|
|
| 1387 |
[data-testid="stAlert"] .streamlit-error {
|
| 1388 |
background-color: #ffe6e6; color: #8c0a0a; border-left: 6px solid #e74c3c;
|
| 1389 |
}
|
| 1390 |
/* FIX: Quote for you (st.info) text color to black */
|
| 1391 |
.stInfo {
|
| 1392 |
-
background-color: #e6f7ff;
|
| 1393 |
-
border-left: 6px solid #64b5f6;
|
| 1394 |
-
|
| 1395 |
-
color: black !important;
|
| 1396 |
border-radius: 10px;
|
| 1397 |
padding: 18px 25px;
|
| 1398 |
margin-top: 2rem;
|
|
@@ -1400,27 +1393,29 @@ def show_main_app():
|
|
| 1400 |
font-size: 1.05em;
|
| 1401 |
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 1402 |
}
|
| 1403 |
-
/*
|
| 1404 |
.stInfo p,
|
| 1405 |
.stInfo span,
|
| 1406 |
.stInfo strong,
|
| 1407 |
.stInfo div {
|
| 1408 |
color: black !important;
|
|
|
|
|
|
|
| 1409 |
}
|
| 1410 |
|
| 1411 |
|
| 1412 |
-
/* Chat Message Bubbles */
|
| 1413 |
.user-message-container {
|
| 1414 |
display: flex;
|
| 1415 |
-
justify-content: flex-end;
|
| 1416 |
margin-bottom: 15px;
|
| 1417 |
}
|
| 1418 |
.user-message {
|
| 1419 |
-
background-color: #e0e6f6;
|
| 1420 |
color: #343a40;
|
| 1421 |
-
border-radius: 18px 18px 5px 18px;
|
| 1422 |
padding: 12px 18px;
|
| 1423 |
-
max-width: 75%;
|
| 1424 |
box-shadow: 0 4px 10px rgba(0,0,0,0.08);
|
| 1425 |
line-height: 1.5;
|
| 1426 |
text-align: left;
|
|
@@ -1428,13 +1423,13 @@ def show_main_app():
|
|
| 1428 |
|
| 1429 |
.bot-message-container {
|
| 1430 |
display: flex;
|
| 1431 |
-
justify-content: flex-start;
|
| 1432 |
margin-bottom: 15px;
|
| 1433 |
}
|
| 1434 |
.bot-message {
|
| 1435 |
-
background-color: #ffffff;
|
| 1436 |
color: #343a40;
|
| 1437 |
-
border-radius: 18px 18px 18px 5px;
|
| 1438 |
padding: 12px 18px;
|
| 1439 |
max-width: 75%;
|
| 1440 |
box-shadow: 0 4px 10px rgba(0,0,0,0.08);
|
|
@@ -1443,7 +1438,7 @@ def show_main_app():
|
|
| 1443 |
}
|
| 1444 |
|
| 1445 |
.chat-separator {
|
| 1446 |
-
border-bottom: 1px dashed #ced4da;
|
| 1447 |
margin: 25px 0;
|
| 1448 |
}
|
| 1449 |
.chat-title {
|
|
@@ -1455,19 +1450,19 @@ def show_main_app():
|
|
| 1455 |
}
|
| 1456 |
|
| 1457 |
|
| 1458 |
-
/* Audio Player */
|
| 1459 |
.stAudio {
|
| 1460 |
margin-top: 1.5rem;
|
| 1461 |
margin-bottom: 2rem;
|
| 1462 |
}
|
| 1463 |
|
| 1464 |
-
/* Expander styling (for conversations) */
|
| 1465 |
.streamlit-expanderHeader {
|
| 1466 |
background-color: #ffffff;
|
| 1467 |
border: 1px solid #e0e0e0;
|
| 1468 |
-
border-radius: 10px;
|
| 1469 |
-
padding: 12px 18px;
|
| 1470 |
-
margin-bottom: 0.8rem;
|
| 1471 |
cursor: pointer;
|
| 1472 |
transition: background-color 0.2s ease, box-shadow 0.2s ease;
|
| 1473 |
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
|
|
@@ -1477,31 +1472,30 @@ def show_main_app():
|
|
| 1477 |
box-shadow: 0 6px 15px rgba(0,0,0,0.08);
|
| 1478 |
}
|
| 1479 |
.streamlit-expanderHeader > div > div > p {
|
| 1480 |
-
font-weight: 600;
|
| 1481 |
color: #343a40;
|
| 1482 |
font-size: 1.05em;
|
| 1483 |
}
|
| 1484 |
.streamlit-expanderContent {
|
| 1485 |
background-color: #f8f9fa;
|
| 1486 |
-
border-left: 4px solid #ced4da;
|
| 1487 |
-
padding: 15px 20px;
|
| 1488 |
border-bottom-left-radius: 10px;
|
| 1489 |
border-bottom-right-radius: 10px;
|
| 1490 |
margin-top: -10px;
|
| 1491 |
-
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
|
| 1492 |
line-height: 1.6;
|
| 1493 |
}
|
| 1494 |
|
| 1495 |
-
|
| 1496 |
-
/* Horizontal rule */
|
| 1497 |
hr {
|
| 1498 |
-
border-top: 2px solid #e9ecef;
|
| 1499 |
margin-top: 3rem;
|
| 1500 |
margin-bottom: 3rem;
|
| 1501 |
}
|
| 1502 |
|
| 1503 |
-
/* Caption (footer) */
|
| 1504 |
-
.footer-caption {
|
| 1505 |
color: #868e96;
|
| 1506 |
font-size: 0.9em;
|
| 1507 |
margin-top: 3rem;
|
|
@@ -1510,7 +1504,7 @@ def show_main_app():
|
|
| 1510 |
letter-spacing: 0.2px;
|
| 1511 |
}
|
| 1512 |
|
| 1513 |
-
/* Container for sections */
|
| 1514 |
.stContainer {
|
| 1515 |
border-radius: 12px;
|
| 1516 |
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
|
@@ -1519,7 +1513,7 @@ def show_main_app():
|
|
| 1519 |
margin-bottom: 2.5rem;
|
| 1520 |
background-color: #ffffff;
|
| 1521 |
}
|
| 1522 |
-
.stContainer.has-border {
|
| 1523 |
border: 1px solid #e0e0e0;
|
| 1524 |
}
|
| 1525 |
|
|
@@ -1544,12 +1538,14 @@ def show_main_app():
|
|
| 1544 |
with st.container(border=True): # Streamlit's built-in container with border
|
| 1545 |
col1, col2 = st.columns(2)
|
| 1546 |
with col1:
|
| 1547 |
-
#
|
| 1548 |
-
st.markdown("
|
| 1549 |
-
selected_category = st.selectbox("
|
|
|
|
| 1550 |
|
| 1551 |
with col2:
|
| 1552 |
st.markdown("<h5>📁 Custom Quotes & Voice Input</h5>", unsafe_allow_html=True)
|
|
|
|
| 1553 |
uploaded_quotes = st.file_uploader("Upload your own quotes (.txt)", type=["txt"], key="quote_uploader")
|
| 1554 |
uploaded_audio = st.file_uploader("Upload a voice message (.wav)", type=["wav"], key="audio_uploader")
|
| 1555 |
|
|
@@ -1587,10 +1583,10 @@ def show_main_app():
|
|
| 1587 |
value=st.session_state.transcribed_text,
|
| 1588 |
height=180, # Increased height for more typing space
|
| 1589 |
placeholder="Type here or use your transcribed voice message...",
|
| 1590 |
-
label_visibility="collapsed" #
|
| 1591 |
)
|
| 1592 |
-
#
|
| 1593 |
-
st.markdown("<label class='stTextArea>label' style='margin-bottom:0.6rem;padding-left:5px;'>Share your thoughts, feelings, or experiences...</label>", unsafe_allow_html=True)
|
| 1594 |
|
| 1595 |
|
| 1596 |
final_input = user_input.strip() or st.session_state.transcribed_text.strip()
|
|
@@ -1728,7 +1724,7 @@ Respond as DilBot with warmth, empathy, and understanding. Keep it conversationa
|
|
| 1728 |
st.info("🌟 Start your first conversation with DilBot to see your personal dashboard and insights!")
|
| 1729 |
|
| 1730 |
st.markdown("---")
|
| 1731 |
-
st.markdown("<p class='footer-caption'>Built by Members of CSG Hackathon Team | Your data is stored privately and securely</p>", unsafe_allow_html=True)
|
| 1732 |
# Main app logic
|
| 1733 |
def main():
|
| 1734 |
if not st.session_state.authenticated:
|
|
|
|
| 1083 |
}
|
| 1084 |
# --- END QUOTE CATEGORIES DEFINITION ---
|
| 1085 |
|
| 1086 |
+
# --- ENHANCED CUSTOM CSS FOR MAIN APP (ONLY FIXING TEXT COLORS AND PRESERVING LAYOUT) ---
|
| 1087 |
st.markdown("""
|
| 1088 |
<style>
|
| 1089 |
/* Global Styles & Background */
|
| 1090 |
.stApp {
|
| 1091 |
+
background: linear-gradient(to bottom right, #f8f9fa, #e9ecef);
|
| 1092 |
+
color: #343a40;
|
| 1093 |
+
font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
| 1094 |
+
-webkit-font-smoothing: antialiased;
|
| 1095 |
+
padding-top: 2rem;
|
| 1096 |
}
|
| 1097 |
|
| 1098 |
/* Streamlit's main block container for content centering and width */
|
| 1099 |
.main .block-container {
|
| 1100 |
+
max-width: 1200px;
|
| 1101 |
padding-top: 2rem;
|
| 1102 |
padding-bottom: 2rem;
|
| 1103 |
padding-left: 1rem;
|
|
|
|
| 1112 |
display: none;
|
| 1113 |
}
|
| 1114 |
|
|
|
|
| 1115 |
/* Header & Titles */
|
| 1116 |
h1, h2, h3, h4, h5, h6 {
|
| 1117 |
+
color: #212529;
|
| 1118 |
+
margin-top: 1.8rem;
|
| 1119 |
+
margin-bottom: 0.9rem;
|
| 1120 |
font-weight: 700;
|
| 1121 |
}
|
| 1122 |
h1 {
|
| 1123 |
font-size: 2.8em;
|
| 1124 |
+
font-weight: 800;
|
| 1125 |
+
color: #5d6dbe;
|
| 1126 |
letter-spacing: -0.8px;
|
| 1127 |
+
text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
|
| 1128 |
}
|
| 1129 |
+
.header-tagline {
|
| 1130 |
font-size: 1.2em;
|
| 1131 |
+
color: #6c757d;
|
| 1132 |
+
margin-top: -0.5rem;
|
| 1133 |
+
margin-bottom: 2.5rem;
|
| 1134 |
font-weight: 400;
|
| 1135 |
}
|
| 1136 |
h2 {
|
| 1137 |
font-size: 2em;
|
| 1138 |
font-weight: 700;
|
| 1139 |
+
border-bottom: 2px solid #e9ecef;
|
| 1140 |
padding-bottom: 0.7rem;
|
| 1141 |
+
margin-bottom: 2rem;
|
| 1142 |
color: #343a40;
|
| 1143 |
}
|
| 1144 |
h3 {
|
|
|
|
| 1148 |
margin-top: 2rem;
|
| 1149 |
margin-bottom: 1.2rem;
|
| 1150 |
}
|
| 1151 |
+
h5 {
|
| 1152 |
font-size: 1.1em;
|
| 1153 |
font-weight: 600;
|
| 1154 |
color: #495057;
|
| 1155 |
margin-bottom: 1rem;
|
| 1156 |
}
|
| 1157 |
|
|
|
|
| 1158 |
/* Metrics (Total Conversations, Most Common Emotion, Avg. Confidence) */
|
| 1159 |
[data-testid="stMetric"] {
|
| 1160 |
background-color: #ffffff;
|
| 1161 |
+
border: 1px solid #dee2e6;
|
| 1162 |
+
border-radius: 12px;
|
| 1163 |
+
padding: 20px;
|
| 1164 |
+
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
| 1165 |
text-align: center;
|
| 1166 |
+
margin-bottom: 1.5rem;
|
| 1167 |
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
| 1168 |
}
|
| 1169 |
[data-testid="stMetric"]:hover {
|
| 1170 |
+
transform: translateY(-5px);
|
| 1171 |
+
box-shadow: 0 12px 30px rgba(0,0,0,0.12);
|
| 1172 |
}
|
| 1173 |
[data-testid="stMetricLabel"] {
|
| 1174 |
+
font-size: 1em;
|
| 1175 |
color: #6c757d;
|
| 1176 |
+
margin-bottom: 8px;
|
| 1177 |
font-weight: 500;
|
| 1178 |
}
|
| 1179 |
[data-testid="stMetricValue"] {
|
| 1180 |
+
font-size: 2.8em;
|
| 1181 |
+
font-weight: 800;
|
| 1182 |
+
color: #5d6dbe;
|
| 1183 |
}
|
| 1184 |
|
| 1185 |
/* Buttons */
|
| 1186 |
.stButton>button {
|
| 1187 |
+
background-color: #5d6dbe;
|
| 1188 |
color: white;
|
| 1189 |
border: none;
|
| 1190 |
+
border-radius: 10px;
|
| 1191 |
padding: 12px 25px;
|
| 1192 |
font-size: 1.1em;
|
| 1193 |
font-weight: bold;
|
|
|
|
| 1197 |
letter-spacing: 0.5px;
|
| 1198 |
}
|
| 1199 |
.stButton>button:hover {
|
| 1200 |
+
background-color: #4a5c9d;
|
| 1201 |
+
transform: translateY(-3px);
|
| 1202 |
box-shadow: 0 8px 20px rgba(0,0,0,0.15);
|
| 1203 |
}
|
| 1204 |
.stButton>button:active {
|
|
|
|
| 1208 |
}
|
| 1209 |
/* Logout button specific style */
|
| 1210 |
[key="logout_btn"] > button {
|
| 1211 |
+
background-color: #dc3545;
|
| 1212 |
box-shadow: 0 5px 15px rgba(220,53,69,0.2);
|
| 1213 |
}
|
| 1214 |
[key="logout_btn"] > button:hover {
|
|
|
|
| 1221 |
.stTextInput>div>div>input, .stTextArea>div>div>textarea {
|
| 1222 |
border-radius: 10px;
|
| 1223 |
border: 1px solid #ced4da;
|
| 1224 |
+
padding: 14px 18px;
|
| 1225 |
font-size: 1.05em;
|
| 1226 |
color: #343a40;
|
| 1227 |
+
background-color: #fcfcfc;
|
| 1228 |
+
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
|
| 1229 |
transition: border-color 0.3s ease, box-shadow 0.3s ease;
|
| 1230 |
}
|
| 1231 |
.stTextInput>div>div>input:focus, .stTextArea>div>div>textarea:focus {
|
| 1232 |
+
border-color: #5d6dbe;
|
| 1233 |
+
box-shadow: 0 0 0 0.25rem rgba(93,109,190,0.25);
|
| 1234 |
outline: none;
|
| 1235 |
}
|
| 1236 |
.stTextInput>label, .stTextArea>label {
|
| 1237 |
font-weight: 600;
|
| 1238 |
color: #495057;
|
| 1239 |
+
margin-bottom: 0.6rem;
|
| 1240 |
}
|
| 1241 |
|
| 1242 |
+
/* Selectbox (Dropdown) Text Color Fixes */
|
|
|
|
| 1243 |
[data-testid="stSelectbox"] > div:first-child > div:first-child {
|
| 1244 |
border-radius: 10px;
|
| 1245 |
border: 1px solid #ced4da;
|
| 1246 |
background-color: #fcfcfc;
|
| 1247 |
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
|
| 1248 |
+
display: flex;
|
| 1249 |
+
align-items: center;
|
| 1250 |
+
min-height: 48px;
|
| 1251 |
+
padding: 0 10px;
|
| 1252 |
}
|
| 1253 |
.stSelectbox>label {
|
| 1254 |
font-weight: 600;
|
| 1255 |
color: #495057;
|
| 1256 |
margin-bottom: 0.6rem;
|
| 1257 |
}
|
| 1258 |
+
/* Force selected value text to black */
|
| 1259 |
[data-testid="stSelectbox"] input[type="text"] {
|
| 1260 |
+
color: black !important;
|
| 1261 |
+
-webkit-text-fill-color: black !important; /* For Webkit browsers */
|
| 1262 |
+
opacity: 1 !important;
|
| 1263 |
+
flex-grow: 1;
|
| 1264 |
+
padding: 12px 5px;
|
| 1265 |
+
font-size: 1.05em;
|
| 1266 |
+
line-height: 1.2em;
|
| 1267 |
+
min-height: 1.2em;
|
| 1268 |
+
background-color: transparent !important;
|
| 1269 |
+
border: none !important;
|
| 1270 |
+
outline: none !important;
|
| 1271 |
+
box-shadow: none !important;
|
| 1272 |
+
}
|
| 1273 |
+
/* Force dropdown arrow to black */
|
|
|
|
|
|
|
| 1274 |
[data-testid="stSelectbox"] button {
|
| 1275 |
+
background-color: transparent !important;
|
| 1276 |
+
border: none !important;
|
| 1277 |
+
padding: 0 5px;
|
| 1278 |
cursor: pointer;
|
| 1279 |
+
display: flex;
|
| 1280 |
align-items: center;
|
| 1281 |
justify-content: center;
|
| 1282 |
}
|
|
|
|
| 1283 |
[data-testid="stSelectbox"] svg {
|
| 1284 |
+
fill: black !important;
|
| 1285 |
+
color: black !important;
|
| 1286 |
+
font-size: 1.5em !important;
|
| 1287 |
+
width: 1em !important;
|
| 1288 |
+
height: 1em !important;
|
| 1289 |
}
|
|
|
|
| 1290 |
[data-testid="stSelectbox"] svg path {
|
| 1291 |
fill: black !important;
|
| 1292 |
}
|
| 1293 |
|
| 1294 |
|
| 1295 |
+
/* File Uploader Text Color Fixes */
|
| 1296 |
[data-testid="stFileUploaderDropzone"] {
|
| 1297 |
+
border-radius: 12px;
|
| 1298 |
border: 2px dashed #a0a8b4;
|
| 1299 |
+
background-color: #ffffff !important;
|
| 1300 |
+
padding: 25px;
|
| 1301 |
transition: border-color 0.3s ease, background-color 0.3s ease;
|
| 1302 |
margin-bottom: 1.5rem;
|
| 1303 |
+
display: flex;
|
| 1304 |
flex-direction: column;
|
| 1305 |
justify-content: center;
|
| 1306 |
align-items: center;
|
| 1307 |
text-align: center;
|
| 1308 |
min-height: 120px;
|
| 1309 |
+
overflow: hidden;
|
| 1310 |
}
|
| 1311 |
[data-testid="stFileUploaderDropzone"]:hover {
|
| 1312 |
+
border-color: #5d6dbe;
|
| 1313 |
background-color: #f7f9fb;
|
| 1314 |
}
|
| 1315 |
+
/* Force ALL text inside file uploader dropzone to black */
|
|
|
|
|
|
|
| 1316 |
[data-testid="stFileUploaderDropzone"] *,
|
| 1317 |
[data-testid="stFileUploaderDropzone"] p,
|
| 1318 |
[data-testid="stFileUploaderDropzone"] span,
|
| 1319 |
[data-testid="stFileUploaderDropzone"] div {
|
| 1320 |
+
color: black !important;
|
| 1321 |
+
-webkit-text-fill-color: black !important;
|
| 1322 |
+
opacity: 1 !important;
|
| 1323 |
+
white-space: normal !important;
|
| 1324 |
+
word-break: break-word !important;
|
| 1325 |
+
font-weight: normal !important;
|
| 1326 |
}
|
| 1327 |
+
/* Specific text within the file uploader (e.g., "Drag and drop file here") */
|
| 1328 |
[data-testid="stFileUploaderDropzone"] > div > div > div:nth-child(2) > div:first-child {
|
| 1329 |
color: black !important;
|
| 1330 |
}
|
|
|
|
| 1332 |
color: black !important;
|
| 1333 |
}
|
| 1334 |
|
|
|
|
| 1335 |
[data-testid="stFileUploaderFileName"] {
|
| 1336 |
font-size: 0.95em;
|
| 1337 |
color: #495057;
|
| 1338 |
margin-top: 10px;
|
| 1339 |
+
word-break: break-all;
|
| 1340 |
}
|
| 1341 |
+
[data-testid="stFileUploaderFile"] {
|
| 1342 |
background-color: #e9ecef;
|
| 1343 |
border-radius: 8px;
|
| 1344 |
padding: 8px 12px;
|
|
|
|
| 1350 |
/* Information, Success, Error, Warning Boxes */
|
| 1351 |
[data-testid="stAlert"] {
|
| 1352 |
border-radius: 10px;
|
| 1353 |
+
padding: 18px 25px;
|
| 1354 |
+
margin-bottom: 1.8rem;
|
| 1355 |
+
font-size: 1.05em;
|
| 1356 |
line-height: 1.6;
|
| 1357 |
text-align: left;
|
| 1358 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 1359 |
}
|
| 1360 |
+
/* Warning alert style (keep original color) */
|
| 1361 |
[data-testid="stAlert"] .streamlit-warning {
|
| 1362 |
background-color: #fef7e0; color: #7a5f00; border-left: 6px solid #ffcc00;
|
| 1363 |
}
|
|
|
|
| 1365 |
[data-testid="stAlert"] .streamlit-success {
|
| 1366 |
background-color: #e6ffe6;
|
| 1367 |
border-left: 6px solid #4CAF50;
|
| 1368 |
+
color: black !important; /* General color for the container */
|
|
|
|
| 1369 |
}
|
| 1370 |
+
/* Aggressive targeting for specific text elements within st.success */
|
| 1371 |
[data-testid="stAlert"] .streamlit-success p,
|
| 1372 |
[data-testid="stAlert"] .streamlit-success span,
|
| 1373 |
+
[data-testid="stAlert"] .streamlit-success div,
|
| 1374 |
+
[data-testid="stAlert"] .streamlit-success strong { /* Added strong for bold text */
|
| 1375 |
color: black !important;
|
| 1376 |
+
-webkit-text-fill-color: black !important;
|
| 1377 |
+
opacity: 1 !important;
|
| 1378 |
}
|
| 1379 |
|
| 1380 |
+
/* Error alert style (keep original color) */
|
| 1381 |
[data-testid="stAlert"] .streamlit-error {
|
| 1382 |
background-color: #ffe6e6; color: #8c0a0a; border-left: 6px solid #e74c3c;
|
| 1383 |
}
|
| 1384 |
/* FIX: Quote for you (st.info) text color to black */
|
| 1385 |
.stInfo {
|
| 1386 |
+
background-color: #e6f7ff;
|
| 1387 |
+
border-left: 6px solid #64b5f6;
|
| 1388 |
+
color: black !important; /* General color for the container */
|
|
|
|
| 1389 |
border-radius: 10px;
|
| 1390 |
padding: 18px 25px;
|
| 1391 |
margin-top: 2rem;
|
|
|
|
| 1393 |
font-size: 1.05em;
|
| 1394 |
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
| 1395 |
}
|
| 1396 |
+
/* Aggressive targeting for specific text elements within st.info */
|
| 1397 |
.stInfo p,
|
| 1398 |
.stInfo span,
|
| 1399 |
.stInfo strong,
|
| 1400 |
.stInfo div {
|
| 1401 |
color: black !important;
|
| 1402 |
+
-webkit-text-fill-color: black !important;
|
| 1403 |
+
opacity: 1 !important;
|
| 1404 |
}
|
| 1405 |
|
| 1406 |
|
| 1407 |
+
/* Chat Message Bubbles (kept original styles) */
|
| 1408 |
.user-message-container {
|
| 1409 |
display: flex;
|
| 1410 |
+
justify-content: flex-end;
|
| 1411 |
margin-bottom: 15px;
|
| 1412 |
}
|
| 1413 |
.user-message {
|
| 1414 |
+
background-color: #e0e6f6;
|
| 1415 |
color: #343a40;
|
| 1416 |
+
border-radius: 18px 18px 5px 18px;
|
| 1417 |
padding: 12px 18px;
|
| 1418 |
+
max-width: 75%;
|
| 1419 |
box-shadow: 0 4px 10px rgba(0,0,0,0.08);
|
| 1420 |
line-height: 1.5;
|
| 1421 |
text-align: left;
|
|
|
|
| 1423 |
|
| 1424 |
.bot-message-container {
|
| 1425 |
display: flex;
|
| 1426 |
+
justify-content: flex-start;
|
| 1427 |
margin-bottom: 15px;
|
| 1428 |
}
|
| 1429 |
.bot-message {
|
| 1430 |
+
background-color: #ffffff;
|
| 1431 |
color: #343a40;
|
| 1432 |
+
border-radius: 18px 18px 18px 5px;
|
| 1433 |
padding: 12px 18px;
|
| 1434 |
max-width: 75%;
|
| 1435 |
box-shadow: 0 4px 10px rgba(0,0,0,0.08);
|
|
|
|
| 1438 |
}
|
| 1439 |
|
| 1440 |
.chat-separator {
|
| 1441 |
+
border-bottom: 1px dashed #ced4da;
|
| 1442 |
margin: 25px 0;
|
| 1443 |
}
|
| 1444 |
.chat-title {
|
|
|
|
| 1450 |
}
|
| 1451 |
|
| 1452 |
|
| 1453 |
+
/* Audio Player (kept original styles) */
|
| 1454 |
.stAudio {
|
| 1455 |
margin-top: 1.5rem;
|
| 1456 |
margin-bottom: 2rem;
|
| 1457 |
}
|
| 1458 |
|
| 1459 |
+
/* Expander styling (for conversations - kept original styles) */
|
| 1460 |
.streamlit-expanderHeader {
|
| 1461 |
background-color: #ffffff;
|
| 1462 |
border: 1px solid #e0e0e0;
|
| 1463 |
+
border-radius: 10px;
|
| 1464 |
+
padding: 12px 18px;
|
| 1465 |
+
margin-bottom: 0.8rem;
|
| 1466 |
cursor: pointer;
|
| 1467 |
transition: background-color 0.2s ease, box-shadow 0.2s ease;
|
| 1468 |
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
|
|
|
|
| 1472 |
box-shadow: 0 6px 15px rgba(0,0,0,0.08);
|
| 1473 |
}
|
| 1474 |
.streamlit-expanderHeader > div > div > p {
|
| 1475 |
+
font-weight: 600;
|
| 1476 |
color: #343a40;
|
| 1477 |
font-size: 1.05em;
|
| 1478 |
}
|
| 1479 |
.streamlit-expanderContent {
|
| 1480 |
background-color: #f8f9fa;
|
| 1481 |
+
border-left: 4px solid #ced4da;
|
| 1482 |
+
padding: 15px 20px;
|
| 1483 |
border-bottom-left-radius: 10px;
|
| 1484 |
border-bottom-right-radius: 10px;
|
| 1485 |
margin-top: -10px;
|
| 1486 |
+
box-shadow: inset 0 2px 5px rgba(0,0,0,0.03);
|
| 1487 |
line-height: 1.6;
|
| 1488 |
}
|
| 1489 |
|
| 1490 |
+
/* Horizontal rule (kept original styles) */
|
|
|
|
| 1491 |
hr {
|
| 1492 |
+
border-top: 2px solid #e9ecef;
|
| 1493 |
margin-top: 3rem;
|
| 1494 |
margin-bottom: 3rem;
|
| 1495 |
}
|
| 1496 |
|
| 1497 |
+
/* Caption (footer - kept original styles) */
|
| 1498 |
+
.footer-caption {
|
| 1499 |
color: #868e96;
|
| 1500 |
font-size: 0.9em;
|
| 1501 |
margin-top: 3rem;
|
|
|
|
| 1504 |
letter-spacing: 0.2px;
|
| 1505 |
}
|
| 1506 |
|
| 1507 |
+
/* Container for sections (kept original styles) */
|
| 1508 |
.stContainer {
|
| 1509 |
border-radius: 12px;
|
| 1510 |
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
|
|
|
|
| 1513 |
margin-bottom: 2.5rem;
|
| 1514 |
background-color: #ffffff;
|
| 1515 |
}
|
| 1516 |
+
.stContainer.has-border {
|
| 1517 |
border: 1px solid #e0e0e0;
|
| 1518 |
}
|
| 1519 |
|
|
|
|
| 1538 |
with st.container(border=True): # Streamlit's built-in container with border
|
| 1539 |
col1, col2 = st.columns(2)
|
| 1540 |
with col1:
|
| 1541 |
+
# Reverting to direct st.selectbox with a visible label
|
| 1542 |
+
st.markdown("🎯 **Choose a quote theme:**") # Custom label for the selectbox
|
| 1543 |
+
selected_category = st.selectbox("Select Quote Theme", list(quote_categories.keys()), label_visibility="collapsed") # Original label hidden
|
| 1544 |
+
# The custom markdown above provides the visual label, while the st.selectbox's internal label is hidden.
|
| 1545 |
|
| 1546 |
with col2:
|
| 1547 |
st.markdown("<h5>📁 Custom Quotes & Voice Input</h5>", unsafe_allow_html=True)
|
| 1548 |
+
# Ensure file uploader labels are visible
|
| 1549 |
uploaded_quotes = st.file_uploader("Upload your own quotes (.txt)", type=["txt"], key="quote_uploader")
|
| 1550 |
uploaded_audio = st.file_uploader("Upload a voice message (.wav)", type=["wav"], key="audio_uploader")
|
| 1551 |
|
|
|
|
| 1583 |
value=st.session_state.transcribed_text,
|
| 1584 |
height=180, # Increased height for more typing space
|
| 1585 |
placeholder="Type here or use your transcribed voice message...",
|
| 1586 |
+
# label_visibility="collapsed" # Removed, rely on default or custom markdown if needed
|
| 1587 |
)
|
| 1588 |
+
# Re-adding explicit label for text area if needed, to be safe
|
| 1589 |
+
# st.markdown("<label class='stTextArea>label' style='margin-bottom:0.6rem;padding-left:5px;'>Share your thoughts, feelings, or experiences...</label>", unsafe_allow_html=True)
|
| 1590 |
|
| 1591 |
|
| 1592 |
final_input = user_input.strip() or st.session_state.transcribed_text.strip()
|
|
|
|
| 1724 |
st.info("🌟 Start your first conversation with DilBot to see your personal dashboard and insights!")
|
| 1725 |
|
| 1726 |
st.markdown("---")
|
| 1727 |
+
st.markdown("<p class='footer-caption'>Built by Members of CSG Hackathon Team | Your data is stored privately and securely</p>", unsafe_allow_html=True)
|
| 1728 |
# Main app logic
|
| 1729 |
def main():
|
| 1730 |
if not st.session_state.authenticated:
|