Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -363,53 +363,267 @@ examples = [
|
|
| 363 |
def create_interface():
|
| 364 |
"""Create the Gradio ChatInterface"""
|
| 365 |
|
| 366 |
-
#
|
| 367 |
custom_css = """
|
|
|
|
| 368 |
.gradio-container {
|
| 369 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
|
| 370 |
-
max-width:
|
| 371 |
margin: auto !important;
|
|
|
|
|
|
|
|
|
|
| 372 |
}
|
| 373 |
|
|
|
|
| 374 |
.header-text {
|
| 375 |
text-align: center;
|
| 376 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 377 |
color: white;
|
| 378 |
-
padding: 2rem;
|
| 379 |
-
border-radius:
|
| 380 |
-
margin-bottom:
|
| 381 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
}
|
| 383 |
|
| 384 |
.header-text h1 {
|
| 385 |
margin: 0;
|
| 386 |
-
font-size:
|
| 387 |
-
font-weight:
|
| 388 |
display: flex;
|
| 389 |
align-items: center;
|
| 390 |
justify-content: center;
|
| 391 |
-
gap:
|
|
|
|
|
|
|
|
|
|
| 392 |
}
|
| 393 |
|
| 394 |
.header-text p {
|
| 395 |
-
margin:
|
| 396 |
-
font-size: 1.
|
| 397 |
-
opacity: 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
}
|
| 399 |
|
|
|
|
| 400 |
.reset-btn {
|
| 401 |
-
background: #
|
| 402 |
color: white !important;
|
| 403 |
border: none !important;
|
| 404 |
-
border-radius:
|
| 405 |
-
padding: 0.5rem
|
| 406 |
font-weight: 600 !important;
|
| 407 |
margin: 0.5rem 0 !important;
|
|
|
|
|
|
|
| 408 |
}
|
| 409 |
|
| 410 |
.reset-btn:hover {
|
| 411 |
-
background: #
|
| 412 |
-
transform: translateY(-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
}
|
| 414 |
"""
|
| 415 |
|
|
|
|
| 363 |
def create_interface():
|
| 364 |
"""Create the Gradio ChatInterface"""
|
| 365 |
|
| 366 |
+
# Enhanced CSS with modern design improvements
|
| 367 |
custom_css = """
|
| 368 |
+
/* Global Styles */
|
| 369 |
.gradio-container {
|
| 370 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif !important;
|
| 371 |
+
max-width: 1200px !important;
|
| 372 |
margin: auto !important;
|
| 373 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%) !important;
|
| 374 |
+
min-height: 100vh !important;
|
| 375 |
+
padding: 1rem !important;
|
| 376 |
}
|
| 377 |
|
| 378 |
+
/* Enhanced Header */
|
| 379 |
.header-text {
|
| 380 |
text-align: center;
|
| 381 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 382 |
color: white;
|
| 383 |
+
padding: 3rem 2rem;
|
| 384 |
+
border-radius: 20px;
|
| 385 |
+
margin-bottom: 2rem;
|
| 386 |
+
box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
|
| 387 |
+
position: relative;
|
| 388 |
+
overflow: hidden;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
.header-text::before {
|
| 392 |
+
content: '';
|
| 393 |
+
position: absolute;
|
| 394 |
+
top: -50%;
|
| 395 |
+
left: -50%;
|
| 396 |
+
width: 200%;
|
| 397 |
+
height: 200%;
|
| 398 |
+
background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
|
| 399 |
+
animation: pulse 4s ease-in-out infinite;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
@keyframes pulse {
|
| 403 |
+
0%, 100% { opacity: 0.3; }
|
| 404 |
+
50% { opacity: 0.6; }
|
| 405 |
}
|
| 406 |
|
| 407 |
.header-text h1 {
|
| 408 |
margin: 0;
|
| 409 |
+
font-size: 3rem;
|
| 410 |
+
font-weight: 800;
|
| 411 |
display: flex;
|
| 412 |
align-items: center;
|
| 413 |
justify-content: center;
|
| 414 |
+
gap: 1rem;
|
| 415 |
+
position: relative;
|
| 416 |
+
z-index: 1;
|
| 417 |
+
text-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
| 418 |
}
|
| 419 |
|
| 420 |
.header-text p {
|
| 421 |
+
margin: 1rem 0 0 0;
|
| 422 |
+
font-size: 1.2rem;
|
| 423 |
+
opacity: 0.95;
|
| 424 |
+
position: relative;
|
| 425 |
+
z-index: 1;
|
| 426 |
+
font-weight: 300;
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
.badge {
|
| 430 |
+
background: rgba(255,255,255,0.25) !important;
|
| 431 |
+
backdrop-filter: blur(10px);
|
| 432 |
+
border: 1px solid rgba(255,255,255,0.3);
|
| 433 |
+
animation: glow 2s ease-in-out infinite alternate;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
@keyframes glow {
|
| 437 |
+
from { box-shadow: 0 0 5px rgba(255,255,255,0.3); }
|
| 438 |
+
to { box-shadow: 0 0 20px rgba(255,255,255,0.6); }
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
/* Chat Interface Styling */
|
| 442 |
+
.gradio-chatinterface {
|
| 443 |
+
background: white !important;
|
| 444 |
+
border-radius: 20px !important;
|
| 445 |
+
box-shadow: 0 25px 50px rgba(0,0,0,0.15) !important;
|
| 446 |
+
padding: 2rem !important;
|
| 447 |
+
margin: 1rem 0 !important;
|
| 448 |
+
backdrop-filter: blur(10px) !important;
|
| 449 |
}
|
| 450 |
|
| 451 |
+
/* Enhanced Buttons */
|
| 452 |
.reset-btn {
|
| 453 |
+
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%) !important;
|
| 454 |
color: white !important;
|
| 455 |
border: none !important;
|
| 456 |
+
border-radius: 12px !important;
|
| 457 |
+
padding: 0.75rem 1.5rem !important;
|
| 458 |
font-weight: 600 !important;
|
| 459 |
margin: 0.5rem 0 !important;
|
| 460 |
+
transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
|
| 461 |
+
box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3) !important;
|
| 462 |
}
|
| 463 |
|
| 464 |
.reset-btn:hover {
|
| 465 |
+
background: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%) !important;
|
| 466 |
+
transform: translateY(-2px) scale(1.02) !important;
|
| 467 |
+
box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4) !important;
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
/* Example Buttons Enhancement */
|
| 471 |
+
.gradio-chatinterface .examples .example {
|
| 472 |
+
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
|
| 473 |
+
border: 2px solid #e2e8f0 !important;
|
| 474 |
+
border-radius: 15px !important;
|
| 475 |
+
padding: 0.75rem 1rem !important;
|
| 476 |
+
margin: 0.5rem !important;
|
| 477 |
+
transition: all 0.3s ease !important;
|
| 478 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
.gradio-chatinterface .examples .example:hover {
|
| 482 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 483 |
+
color: white !important;
|
| 484 |
+
border-color: #667eea !important;
|
| 485 |
+
transform: translateY(-2px) !important;
|
| 486 |
+
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3) !important;
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
/* Enhanced Stats Cards */
|
| 490 |
+
.stats-container {
|
| 491 |
+
display: grid;
|
| 492 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 493 |
+
gap: 1.5rem;
|
| 494 |
+
margin: 2rem 0;
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
.stat-card {
|
| 498 |
+
background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
|
| 499 |
+
border-radius: 16px;
|
| 500 |
+
padding: 2rem;
|
| 501 |
+
text-align: center;
|
| 502 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
|
| 503 |
+
border: 1px solid #e2e8f0;
|
| 504 |
+
transition: all 0.3s ease;
|
| 505 |
+
position: relative;
|
| 506 |
+
overflow: hidden;
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
.stat-card::before {
|
| 510 |
+
content: '';
|
| 511 |
+
position: absolute;
|
| 512 |
+
top: 0;
|
| 513 |
+
left: 0;
|
| 514 |
+
right: 0;
|
| 515 |
+
height: 4px;
|
| 516 |
+
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
.stat-card:hover {
|
| 520 |
+
transform: translateY(-5px);
|
| 521 |
+
box-shadow: 0 20px 40px rgba(0,0,0,0.15);
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
.stat-number {
|
| 525 |
+
font-size: 2.5rem;
|
| 526 |
+
font-weight: 800;
|
| 527 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 528 |
+
-webkit-background-clip: text;
|
| 529 |
+
-webkit-text-fill-color: transparent;
|
| 530 |
+
background-clip: text;
|
| 531 |
+
margin-bottom: 0.5rem;
|
| 532 |
+
}
|
| 533 |
+
|
| 534 |
+
.stat-label {
|
| 535 |
+
color: #64748b;
|
| 536 |
+
font-size: 0.9rem;
|
| 537 |
+
font-weight: 500;
|
| 538 |
+
text-transform: uppercase;
|
| 539 |
+
letter-spacing: 1px;
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
/* Enhanced Accordion */
|
| 543 |
+
.gradio-accordion {
|
| 544 |
+
background: rgba(255,255,255,0.9) !important;
|
| 545 |
+
backdrop-filter: blur(10px) !important;
|
| 546 |
+
border-radius: 16px !important;
|
| 547 |
+
border: 1px solid rgba(255,255,255,0.2) !important;
|
| 548 |
+
box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
|
| 549 |
+
margin: 1.5rem 0 !important;
|
| 550 |
+
}
|
| 551 |
+
|
| 552 |
+
/* Feature Cards */
|
| 553 |
+
.feature-grid {
|
| 554 |
+
display: grid;
|
| 555 |
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
| 556 |
+
gap: 1.5rem;
|
| 557 |
+
margin: 2rem 0;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
.feature-card {
|
| 561 |
+
background: rgba(255,255,255,0.95);
|
| 562 |
+
backdrop-filter: blur(10px);
|
| 563 |
+
border-radius: 16px;
|
| 564 |
+
padding: 1.5rem;
|
| 565 |
+
border: 1px solid rgba(255,255,255,0.3);
|
| 566 |
+
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
.feature-icon {
|
| 570 |
+
font-size: 2rem;
|
| 571 |
+
margin-bottom: 1rem;
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
.feature-title {
|
| 575 |
+
color: #2d3748;
|
| 576 |
+
font-size: 1.25rem;
|
| 577 |
+
font-weight: 600;
|
| 578 |
+
margin-bottom: 0.5rem;
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
.feature-desc {
|
| 582 |
+
color: #64748b;
|
| 583 |
+
line-height: 1.6;
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
/* Responsive Design */
|
| 587 |
+
@media (max-width: 768px) {
|
| 588 |
+
.gradio-container {
|
| 589 |
+
padding: 0.5rem !important;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
.header-text h1 {
|
| 593 |
+
font-size: 2rem;
|
| 594 |
+
flex-direction: column;
|
| 595 |
+
gap: 0.5rem;
|
| 596 |
+
}
|
| 597 |
+
|
| 598 |
+
.header-text {
|
| 599 |
+
padding: 2rem 1rem;
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
.stats-container {
|
| 603 |
+
grid-template-columns: repeat(2, 1fr);
|
| 604 |
+
gap: 1rem;
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
.stat-card {
|
| 608 |
+
padding: 1.5rem;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
.feature-grid {
|
| 612 |
+
grid-template-columns: 1fr;
|
| 613 |
+
gap: 1rem;
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
/* Loading Animation */
|
| 618 |
+
@keyframes shimmer {
|
| 619 |
+
0% { background-position: -468px 0; }
|
| 620 |
+
100% { background-position: 468px 0; }
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
+
.loading {
|
| 624 |
+
animation: shimmer 1.5s ease-in-out infinite;
|
| 625 |
+
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
| 626 |
+
background-size: 400% 100%;
|
| 627 |
}
|
| 628 |
"""
|
| 629 |
|