Spaces:
Runtime error
Runtime error
Update app
Browse files
app.py
CHANGED
|
@@ -201,6 +201,257 @@ def test_service():
|
|
| 201 |
return f"β **Test Error**: {str(e)}"
|
| 202 |
|
| 203 |
# Fixed CSS - Removed problematic dropdown overrides
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
custom_css = """
|
| 205 |
/* Global container styling */
|
| 206 |
.gradio-container {
|
|
@@ -313,11 +564,24 @@ input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
|
|
| 313 |
outline: none !important;
|
| 314 |
}
|
| 315 |
|
| 316 |
-
/*
|
|
|
|
| 317 |
.gradio-dropdown {
|
| 318 |
margin-bottom: 1rem !important;
|
|
|
|
|
|
|
|
|
|
| 319 |
}
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
/* Button styling */
|
| 322 |
.primary-btn {
|
| 323 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
@@ -352,7 +616,7 @@ input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
|
|
| 352 |
|
| 353 |
.secondary-btn:hover {
|
| 354 |
transform: translateY(-2px) !important;
|
| 355 |
-
|
| 356 |
}
|
| 357 |
|
| 358 |
/* Output area styling */
|
|
@@ -424,11 +688,11 @@ input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
|
|
| 424 |
.finance-header h1 {
|
| 425 |
font-size: 2rem !important;
|
| 426 |
}
|
| 427 |
-
|
| 428 |
.form-section {
|
| 429 |
padding: 1.5rem !important;
|
| 430 |
}
|
| 431 |
-
|
| 432 |
.main-content {
|
| 433 |
margin: 1rem !important;
|
| 434 |
padding: 1.5rem !important;
|
|
@@ -453,6 +717,7 @@ input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
|
|
| 453 |
}
|
| 454 |
"""
|
| 455 |
|
|
|
|
| 456 |
# Create the enhanced interface
|
| 457 |
with gr.Blocks(
|
| 458 |
theme=gr.themes.Soft(primary_hue="blue", secondary_hue="slate"),
|
|
|
|
| 201 |
return f"β **Test Error**: {str(e)}"
|
| 202 |
|
| 203 |
# Fixed CSS - Removed problematic dropdown overrides
|
| 204 |
+
# custom_css = """
|
| 205 |
+
# /* Global container styling */
|
| 206 |
+
# .gradio-container {
|
| 207 |
+
# max-width: 1400px !important;
|
| 208 |
+
# margin: 0 auto !important;
|
| 209 |
+
# background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 210 |
+
# min-height: 100vh;
|
| 211 |
+
# font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 212 |
+
# }
|
| 213 |
+
|
| 214 |
+
# /* Main content area */
|
| 215 |
+
# .main-content {
|
| 216 |
+
# background: rgba(255, 255, 255, 0.95) !important;
|
| 217 |
+
# backdrop-filter: blur(20px) !important;
|
| 218 |
+
# border-radius: 20px !important;
|
| 219 |
+
# padding: 2rem !important;
|
| 220 |
+
# margin: 2rem !important;
|
| 221 |
+
# box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1) !important;
|
| 222 |
+
# border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 223 |
+
# }
|
| 224 |
+
|
| 225 |
+
# /* Header styling */
|
| 226 |
+
# .finance-header {
|
| 227 |
+
# text-align: center;
|
| 228 |
+
# background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
|
| 229 |
+
# color: white;
|
| 230 |
+
# padding: 3rem 2rem;
|
| 231 |
+
# border-radius: 20px;
|
| 232 |
+
# margin-bottom: 2rem;
|
| 233 |
+
# position: relative;
|
| 234 |
+
# overflow: hidden;
|
| 235 |
+
# }
|
| 236 |
+
|
| 237 |
+
# .finance-header::before {
|
| 238 |
+
# content: "";
|
| 239 |
+
# position: absolute;
|
| 240 |
+
# top: 0;
|
| 241 |
+
# left: 0;
|
| 242 |
+
# right: 0;
|
| 243 |
+
# bottom: 0;
|
| 244 |
+
# background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="0.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
|
| 245 |
+
# opacity: 0.1;
|
| 246 |
+
# }
|
| 247 |
+
|
| 248 |
+
# .finance-header h1 {
|
| 249 |
+
# font-size: 3rem !important;
|
| 250 |
+
# font-weight: 800 !important;
|
| 251 |
+
# margin-bottom: 1rem !important;
|
| 252 |
+
# background: linear-gradient(45deg, #ffffff, #e0e7ff);
|
| 253 |
+
# -webkit-background-clip: text;
|
| 254 |
+
# -webkit-text-fill-color: transparent;
|
| 255 |
+
# position: relative;
|
| 256 |
+
# z-index: 1;
|
| 257 |
+
# }
|
| 258 |
+
|
| 259 |
+
# .finance-header p {
|
| 260 |
+
# font-size: 1.25rem !important;
|
| 261 |
+
# opacity: 0.9 !important;
|
| 262 |
+
# margin-bottom: 0 !important;
|
| 263 |
+
# position: relative;
|
| 264 |
+
# z-index: 1;
|
| 265 |
+
# }
|
| 266 |
+
|
| 267 |
+
# /* Icon styling */
|
| 268 |
+
# .finance-icon {
|
| 269 |
+
# font-size: 4rem;
|
| 270 |
+
# margin-bottom: 1rem;
|
| 271 |
+
# position: relative;
|
| 272 |
+
# z-index: 1;
|
| 273 |
+
# }
|
| 274 |
+
|
| 275 |
+
# /* Form sections */
|
| 276 |
+
# .form-section {
|
| 277 |
+
# background: white !important;
|
| 278 |
+
# border-radius: 16px !important;
|
| 279 |
+
# padding: 2rem !important;
|
| 280 |
+
# margin-bottom: 1.5rem !important;
|
| 281 |
+
# box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
|
| 282 |
+
# border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 283 |
+
# transition: all 0.3s ease !important;
|
| 284 |
+
# }
|
| 285 |
+
|
| 286 |
+
# .form-section:hover {
|
| 287 |
+
# box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12) !important;
|
| 288 |
+
# transform: translateY(-2px) !important;
|
| 289 |
+
# }
|
| 290 |
+
|
| 291 |
+
# .form-section h3 {
|
| 292 |
+
# color: #1e3c72 !important;
|
| 293 |
+
# font-weight: 700 !important;
|
| 294 |
+
# font-size: 1.5rem !important;
|
| 295 |
+
# margin-bottom: 1.5rem !important;
|
| 296 |
+
# display: flex !important;
|
| 297 |
+
# align-items: center !important;
|
| 298 |
+
# gap: 0.75rem !important;
|
| 299 |
+
# }
|
| 300 |
+
|
| 301 |
+
# /* Input styling - only for textboxes and numbers, NOT dropdowns */
|
| 302 |
+
# input[type="text"], input[type="number"], textarea {
|
| 303 |
+
# border-radius: 12px !important;
|
| 304 |
+
# border: 2px solid #e5e7eb !important;
|
| 305 |
+
# transition: all 0.3s ease !important;
|
| 306 |
+
# font-size: 1rem !important;
|
| 307 |
+
# padding: 0.75rem 1rem !important;
|
| 308 |
+
# }
|
| 309 |
+
|
| 310 |
+
# input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
|
| 311 |
+
# border-color: #667eea !important;
|
| 312 |
+
# box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
|
| 313 |
+
# outline: none !important;
|
| 314 |
+
# }
|
| 315 |
+
|
| 316 |
+
# /* Minimal dropdown styling - let Gradio handle the functionality */
|
| 317 |
+
# .gradio-dropdown {
|
| 318 |
+
# margin-bottom: 1rem !important;
|
| 319 |
+
# }
|
| 320 |
+
|
| 321 |
+
# /* Button styling */
|
| 322 |
+
# .primary-btn {
|
| 323 |
+
# background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 324 |
+
# border: none !important;
|
| 325 |
+
# border-radius: 12px !important;
|
| 326 |
+
# padding: 1rem 2rem !important;
|
| 327 |
+
# font-size: 1.1rem !important;
|
| 328 |
+
# font-weight: 600 !important;
|
| 329 |
+
# color: white !important;
|
| 330 |
+
# transition: all 0.3s ease !important;
|
| 331 |
+
# box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3) !important;
|
| 332 |
+
# min-height: 56px !important;
|
| 333 |
+
# }
|
| 334 |
+
|
| 335 |
+
# .primary-btn:hover {
|
| 336 |
+
# transform: translateY(-2px) !important;
|
| 337 |
+
# box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4) !important;
|
| 338 |
+
# }
|
| 339 |
+
|
| 340 |
+
# .secondary-btn {
|
| 341 |
+
# background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
|
| 342 |
+
# border: none !important;
|
| 343 |
+
# border-radius: 12px !important;
|
| 344 |
+
# padding: 1rem 2rem !important;
|
| 345 |
+
# font-size: 1.1rem !important;
|
| 346 |
+
# font-weight: 600 !important;
|
| 347 |
+
# color: white !important;
|
| 348 |
+
# transition: all 0.3s ease !important;
|
| 349 |
+
# box-shadow: 0 8px 24px rgba(100, 116, 139, 0.3) !important;
|
| 350 |
+
# min-height: 56px !important;
|
| 351 |
+
# }
|
| 352 |
+
|
| 353 |
+
# .secondary-btn:hover {
|
| 354 |
+
# transform: translateY(-2px) !important;
|
| 355 |
+
# box-shadow: 0 12px 32px rgba(100, 116, 139, 0.4) !important;
|
| 356 |
+
# }
|
| 357 |
+
|
| 358 |
+
# /* Output area styling */
|
| 359 |
+
# .output-area {
|
| 360 |
+
# background: white !important;
|
| 361 |
+
# border-radius: 16px !important;
|
| 362 |
+
# padding: 2rem !important;
|
| 363 |
+
# margin-top: 2rem !important;
|
| 364 |
+
# box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08) !important;
|
| 365 |
+
# border: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 366 |
+
# min-height: 200px !important;
|
| 367 |
+
# }
|
| 368 |
+
|
| 369 |
+
# /* Tips section */
|
| 370 |
+
# .tips-section {
|
| 371 |
+
# background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
|
| 372 |
+
# border-radius: 16px !important;
|
| 373 |
+
# padding: 2rem !important;
|
| 374 |
+
# margin: 2rem 0 !important;
|
| 375 |
+
# border-left: 4px solid #667eea !important;
|
| 376 |
+
# }
|
| 377 |
+
|
| 378 |
+
# .tips-section h4 {
|
| 379 |
+
# color: #1e3c72 !important;
|
| 380 |
+
# font-weight: 700 !important;
|
| 381 |
+
# margin-bottom: 1rem !important;
|
| 382 |
+
# }
|
| 383 |
+
|
| 384 |
+
# /* Radio button styling */
|
| 385 |
+
# .gradio-radio {
|
| 386 |
+
# gap: 1rem !important;
|
| 387 |
+
# }
|
| 388 |
+
|
| 389 |
+
# .gradio-radio label {
|
| 390 |
+
# background: white !important;
|
| 391 |
+
# border: 2px solid #e5e7eb !important;
|
| 392 |
+
# border-radius: 12px !important;
|
| 393 |
+
# padding: 1rem !important;
|
| 394 |
+
# transition: all 0.3s ease !important;
|
| 395 |
+
# cursor: pointer !important;
|
| 396 |
+
# }
|
| 397 |
+
|
| 398 |
+
# .gradio-radio label:hover {
|
| 399 |
+
# border-color: #667eea !important;
|
| 400 |
+
# background: #f8fafc !important;
|
| 401 |
+
# }
|
| 402 |
+
|
| 403 |
+
# .gradio-radio input:checked + label {
|
| 404 |
+
# border-color: #667eea !important;
|
| 405 |
+
# background: linear-gradient(135deg, #667eea10, #764ba210) !important;
|
| 406 |
+
# color: #1e3c72 !important;
|
| 407 |
+
# }
|
| 408 |
+
|
| 409 |
+
# /* Progress indicator */
|
| 410 |
+
# .loading-indicator {
|
| 411 |
+
# background: linear-gradient(90deg, #667eea, #764ba2, #667eea) !important;
|
| 412 |
+
# background-size: 200% 100% !important;
|
| 413 |
+
# animation: gradient 2s ease infinite !important;
|
| 414 |
+
# }
|
| 415 |
+
|
| 416 |
+
# @keyframes gradient {
|
| 417 |
+
# 0% { background-position: 0% 50%; }
|
| 418 |
+
# 50% { background-position: 100% 50%; }
|
| 419 |
+
# 100% { background-position: 0% 50%; }
|
| 420 |
+
# }
|
| 421 |
+
|
| 422 |
+
# /* Responsive design */
|
| 423 |
+
# @media (max-width: 768px) {
|
| 424 |
+
# .finance-header h1 {
|
| 425 |
+
# font-size: 2rem !important;
|
| 426 |
+
# }
|
| 427 |
+
|
| 428 |
+
# .form-section {
|
| 429 |
+
# padding: 1.5rem !important;
|
| 430 |
+
# }
|
| 431 |
+
|
| 432 |
+
# .main-content {
|
| 433 |
+
# margin: 1rem !important;
|
| 434 |
+
# padding: 1.5rem !important;
|
| 435 |
+
# }
|
| 436 |
+
# }
|
| 437 |
+
|
| 438 |
+
# /* Chart and finance icons */
|
| 439 |
+
# .finance-bg {
|
| 440 |
+
# position: relative;
|
| 441 |
+
# overflow: hidden;
|
| 442 |
+
# }
|
| 443 |
+
|
| 444 |
+
# .finance-bg::after {
|
| 445 |
+
# content: "πππ°π¦π³π";
|
| 446 |
+
# position: absolute;
|
| 447 |
+
# top: -20px;
|
| 448 |
+
# right: -20px;
|
| 449 |
+
# font-size: 6rem;
|
| 450 |
+
# opacity: 0.05;
|
| 451 |
+
# z-index: 0;
|
| 452 |
+
# transform: rotate(12deg);
|
| 453 |
+
# }
|
| 454 |
+
# """
|
| 455 |
custom_css = """
|
| 456 |
/* Global container styling */
|
| 457 |
.gradio-container {
|
|
|
|
| 564 |
outline: none !important;
|
| 565 |
}
|
| 566 |
|
| 567 |
+
/* Corrected dropdown styling for visibility and clickability */
|
| 568 |
+
/* Ensure dropdown options appear on top and are clickable */
|
| 569 |
.gradio-dropdown {
|
| 570 |
margin-bottom: 1rem !important;
|
| 571 |
+
/* Add z-index to ensure dropdown options appear above other content */
|
| 572 |
+
z-index: 1000 !important;
|
| 573 |
+
position: relative !important; /* Ensure z-index takes effect */
|
| 574 |
}
|
| 575 |
|
| 576 |
+
/* Target the dropdown options list specifically if needed (common Gradio class for overlay) */
|
| 577 |
+
.gr-box.gr-options { /* This might be the actual class for the dropdown menu */
|
| 578 |
+
z-index: 1001 !important; /* Higher than the dropdown container itself */
|
| 579 |
+
position: relative !important;
|
| 580 |
+
/* You might also need to ensure no parent has overflow: hidden that clips it */
|
| 581 |
+
overflow: visible !important;
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
|
| 585 |
/* Button styling */
|
| 586 |
.primary-btn {
|
| 587 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
|
|
| 616 |
|
| 617 |
.secondary-btn:hover {
|
| 618 |
transform: translateY(-2px) !important;
|
| 619 |
+
box_shadow: 0 12px 32px rgba(100, 116, 139, 0.4) !important;
|
| 620 |
}
|
| 621 |
|
| 622 |
/* Output area styling */
|
|
|
|
| 688 |
.finance-header h1 {
|
| 689 |
font-size: 2rem !important;
|
| 690 |
}
|
| 691 |
+
|
| 692 |
.form-section {
|
| 693 |
padding: 1.5rem !important;
|
| 694 |
}
|
| 695 |
+
|
| 696 |
.main-content {
|
| 697 |
margin: 1rem !important;
|
| 698 |
padding: 1.5rem !important;
|
|
|
|
| 717 |
}
|
| 718 |
"""
|
| 719 |
|
| 720 |
+
|
| 721 |
# Create the enhanced interface
|
| 722 |
with gr.Blocks(
|
| 723 |
theme=gr.themes.Soft(primary_hue="blue", secondary_hue="slate"),
|