Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -455,12 +455,11 @@ def main():
|
|
| 455 |
print(f"π₯ GPU Memory: {torch.cuda.memory_allocated() // 1024**2} MB allocated")
|
| 456 |
print(f"π GPU Memory Reserved: {torch.cuda.memory_reserved() // 1024**2} MB reserved")
|
| 457 |
|
| 458 |
-
# Modern glassmorphism CSS
|
| 459 |
-
modern_css =
|
| 460 |
/* Creed AI - Modern Glassmorphism Design */
|
| 461 |
:root {
|
| 462 |
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 463 |
-
--secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
| 464 |
--glass-bg: rgba(255, 255, 255, 0.08);
|
| 465 |
--glass-border: rgba(255, 255, 255, 0.18);
|
| 466 |
--text-primary: #ffffff;
|
|
@@ -469,53 +468,14 @@ def main():
|
|
| 469 |
--accent-blue: #3b82f6;
|
| 470 |
--shadow-glow: 0 8px 32px rgba(139, 92, 246, 0.3);
|
| 471 |
}
|
| 472 |
-
|
| 473 |
.gradio-container {
|
| 474 |
min-height: 100vh !important;
|
| 475 |
background: var(--primary-gradient) !important;
|
| 476 |
-
background-attachment: fixed !important;
|
| 477 |
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
|
| 478 |
color: var(--text-primary) !important;
|
| 479 |
padding: 20px !important;
|
| 480 |
-
position: relative !important;
|
| 481 |
-
overflow-x: hidden !important;
|
| 482 |
-
}
|
| 483 |
-
.gradio-container::before {
|
| 484 |
-
content: '';
|
| 485 |
-
position: fixed;
|
| 486 |
-
top: 0;
|
| 487 |
-
left: 0;
|
| 488 |
-
width: 100%;
|
| 489 |
-
height: 100%;
|
| 490 |
-
background:
|
| 491 |
-
radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
|
| 492 |
-
radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.3) 0%, transparent 50%),
|
| 493 |
-
radial-gradient(circle at 40% 40%, rgba(167, 139, 250, 0.2) 0%, transparent 50%);
|
| 494 |
-
pointer-events: none;
|
| 495 |
-
z-index: -1;
|
| 496 |
-
}
|
| 497 |
-
/* Floating particles animation */
|
| 498 |
-
.gradio-container::after {
|
| 499 |
-
content: '';
|
| 500 |
-
position: fixed;
|
| 501 |
-
top: 0;
|
| 502 |
-
left: 0;
|
| 503 |
-
width: 100%;
|
| 504 |
-
height: 100%;
|
| 505 |
-
background-image:
|
| 506 |
-
radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.3), transparent),
|
| 507 |
-
radial-gradient(2px 2px at 40px 70px, rgba(139, 92, 246, 0.4), transparent),
|
| 508 |
-
radial-gradient(1px 1px at 90px 40px, rgba(59, 130, 246, 0.3), transparent);
|
| 509 |
-
background-size: 120px 120px;
|
| 510 |
-
animation: float 20s ease-in-out infinite;
|
| 511 |
-
pointer-events: none;
|
| 512 |
-
z-index: -1;
|
| 513 |
}
|
| 514 |
-
|
| 515 |
-
0%, 100% { transform: translateY(0px) rotate(0deg); }
|
| 516 |
-
50% { transform: translateY(-20px) rotate(180deg); }
|
| 517 |
-
}
|
| 518 |
-
/* Header styling */
|
| 519 |
.header {
|
| 520 |
background: var(--glass-bg) !important;
|
| 521 |
backdrop-filter: blur(20px) !important;
|
|
@@ -525,35 +485,17 @@ def main():
|
|
| 525 |
margin-bottom: 24px !important;
|
| 526 |
text-align: center !important;
|
| 527 |
box-shadow: var(--shadow-glow) !important;
|
| 528 |
-
position: relative !important;
|
| 529 |
-
overflow: hidden !important;
|
| 530 |
-
}
|
| 531 |
-
.header::before {
|
| 532 |
-
content: '';
|
| 533 |
-
position: absolute;
|
| 534 |
-
top: 0;
|
| 535 |
-
left: 0;
|
| 536 |
-
right: 0;
|
| 537 |
-
height: 1px;
|
| 538 |
-
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
|
| 539 |
}
|
|
|
|
| 540 |
.header h1 {
|
| 541 |
font-size: 36px !important;
|
| 542 |
font-weight: 700 !important;
|
| 543 |
background: linear-gradient(135deg, #ffffff 0%, #a855f7 50%, #3b82f6 100%) !important;
|
| 544 |
-webkit-background-clip: text !important;
|
| 545 |
-webkit-text-fill-color: transparent !important;
|
| 546 |
-
background-clip: text !important;
|
| 547 |
margin: 0 0 12px 0 !important;
|
| 548 |
-
text-shadow: 0 0 30px rgba(168, 85, 247, 0.5) !important;
|
| 549 |
-
}
|
| 550 |
-
.header p {
|
| 551 |
-
font-size: 16px !important;
|
| 552 |
-
color: var(--text-secondary) !important;
|
| 553 |
-
margin: 0 !important;
|
| 554 |
-
font-weight: 500 !important;
|
| 555 |
}
|
| 556 |
-
|
| 557 |
.info-box {
|
| 558 |
background: rgba(255, 255, 255, 0.06) !important;
|
| 559 |
backdrop-filter: blur(16px) !important;
|
|
@@ -562,41 +504,31 @@ def main():
|
|
| 562 |
padding: 20px !important;
|
| 563 |
margin: 16px 0 !important;
|
| 564 |
color: var(--text-secondary) !important;
|
| 565 |
-
font-size: 14px !important;
|
| 566 |
-
line-height: 1.6 !important;
|
| 567 |
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
|
| 568 |
}
|
|
|
|
| 569 |
.status-box {
|
| 570 |
background: rgba(16, 185, 129, 0.1) !important;
|
| 571 |
-
backdrop-filter: blur(16px) !important;
|
| 572 |
border: 1px solid rgba(16, 185, 129, 0.3) !important;
|
| 573 |
border-radius: 16px !important;
|
| 574 |
padding: 16px 20px !important;
|
| 575 |
margin: 16px 0 !important;
|
| 576 |
color: #10b981 !important;
|
| 577 |
font-weight: 600 !important;
|
| 578 |
-
box-shadow: 0 4px 20px rgba(16, 185, 129, 0.2) !important;
|
| 579 |
}
|
| 580 |
-
|
| 581 |
-
.chat-area {
|
| 582 |
background: var(--glass-bg) !important;
|
| 583 |
backdrop-filter: blur(20px) !important;
|
| 584 |
border: 1px solid var(--glass-border) !important;
|
| 585 |
border-radius: 20px !important;
|
| 586 |
margin: 16px 0 !important;
|
| 587 |
-
overflow: hidden !important;
|
| 588 |
box-shadow: var(--shadow-glow) !important;
|
| 589 |
}
|
| 590 |
-
|
| 591 |
.tools-area {
|
| 592 |
-
background: var(--glass-bg) !important;
|
| 593 |
-
backdrop-filter: blur(20px) !important;
|
| 594 |
-
border: 1px solid var(--glass-border) !important;
|
| 595 |
-
border-radius: 20px !important;
|
| 596 |
padding: 28px !important;
|
| 597 |
-
margin: 24px 0 !important;
|
| 598 |
-
box-shadow: var(--shadow-glow) !important;
|
| 599 |
}
|
|
|
|
| 600 |
.tools-title {
|
| 601 |
font-size: 22px !important;
|
| 602 |
font-weight: 600 !important;
|
|
@@ -604,42 +536,8 @@ def main():
|
|
| 604 |
margin: 0 0 20px 0 !important;
|
| 605 |
padding-bottom: 12px !important;
|
| 606 |
border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
|
| 607 |
-
background: linear-gradient(135deg, #ffffff 0%, #a855f7 100%) !important;
|
| 608 |
-
-webkit-background-clip: text !important;
|
| 609 |
-
-webkit-text-fill-color: transparent !important;
|
| 610 |
-
}
|
| 611 |
-
/* Form elements */
|
| 612 |
-
.gradio-textbox input,
|
| 613 |
-
.gradio-textbox textarea {
|
| 614 |
-
background: rgba(255, 255, 255, 0.08) !important;
|
| 615 |
-
backdrop-filter: blur(10px) !important;
|
| 616 |
-
border: 1px solid rgba(255, 255, 255, 0.16) !important;
|
| 617 |
-
color: var(--text-primary) !important;
|
| 618 |
-
border-radius: 12px !important;
|
| 619 |
-
padding: 12px 16px !important;
|
| 620 |
-
transition: all 0.3s ease !important;
|
| 621 |
-
font-size: 14px !important;
|
| 622 |
-
}
|
| 623 |
-
.gradio-textbox input:focus,
|
| 624 |
-
.gradio-textbox textarea:focus {
|
| 625 |
-
border-color: var(--accent-purple) !important;
|
| 626 |
-
outline: none !important;
|
| 627 |
-
box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3) !important;
|
| 628 |
-
background: rgba(255, 255, 255, 0.12) !important;
|
| 629 |
-
}
|
| 630 |
-
.gradio-textbox input::placeholder,
|
| 631 |
-
.gradio-textbox textarea::placeholder {
|
| 632 |
-
color: rgba(255, 255, 255, 0.5) !important;
|
| 633 |
-
}
|
| 634 |
-
/* Labels */
|
| 635 |
-
.gradio-container label {
|
| 636 |
-
color: var(--text-secondary) !important;
|
| 637 |
-
font-weight: 500 !important;
|
| 638 |
-
font-size: 14px !important;
|
| 639 |
-
margin-bottom: 6px !important;
|
| 640 |
-
display: block !important;
|
| 641 |
}
|
| 642 |
-
|
| 643 |
.gradio-container button {
|
| 644 |
background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%) !important;
|
| 645 |
color: var(--text-primary) !important;
|
|
@@ -647,20 +545,241 @@ def main():
|
|
| 647 |
border-radius: 12px !important;
|
| 648 |
padding: 12px 24px !important;
|
| 649 |
font-weight: 600 !important;
|
| 650 |
-
cursor: pointer !important;
|
| 651 |
transition: all 0.3s ease !important;
|
| 652 |
-
box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4) !important;
|
| 653 |
-
backdrop-filter: blur(10px) !important;
|
| 654 |
-
min-height: 44px !important;
|
| 655 |
-
display: flex !important;
|
| 656 |
-
align-items: center !important;
|
| 657 |
-
justify-content: center !important;
|
| 658 |
}
|
|
|
|
| 659 |
.gradio-container button:hover {
|
| 660 |
transform: translateY(-2px) !important;
|
| 661 |
box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6) !important;
|
| 662 |
-
background: linear-gradient(135deg, #9333ea 0%, #2563eb 100%) !important;
|
| 663 |
}
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
print(f"π₯ GPU Memory: {torch.cuda.memory_allocated() // 1024**2} MB allocated")
|
| 456 |
print(f"π GPU Memory Reserved: {torch.cuda.memory_reserved() // 1024**2} MB reserved")
|
| 457 |
|
| 458 |
+
# Modern glassmorphism CSS - keeping it simpler to avoid quote issues
|
| 459 |
+
modern_css = '''
|
| 460 |
/* Creed AI - Modern Glassmorphism Design */
|
| 461 |
:root {
|
| 462 |
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
|
|
| 463 |
--glass-bg: rgba(255, 255, 255, 0.08);
|
| 464 |
--glass-border: rgba(255, 255, 255, 0.18);
|
| 465 |
--text-primary: #ffffff;
|
|
|
|
| 468 |
--accent-blue: #3b82f6;
|
| 469 |
--shadow-glow: 0 8px 32px rgba(139, 92, 246, 0.3);
|
| 470 |
}
|
| 471 |
+
|
| 472 |
.gradio-container {
|
| 473 |
min-height: 100vh !important;
|
| 474 |
background: var(--primary-gradient) !important;
|
|
|
|
|
|
|
| 475 |
color: var(--text-primary) !important;
|
| 476 |
padding: 20px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
}
|
| 478 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
.header {
|
| 480 |
background: var(--glass-bg) !important;
|
| 481 |
backdrop-filter: blur(20px) !important;
|
|
|
|
| 485 |
margin-bottom: 24px !important;
|
| 486 |
text-align: center !important;
|
| 487 |
box-shadow: var(--shadow-glow) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
}
|
| 489 |
+
|
| 490 |
.header h1 {
|
| 491 |
font-size: 36px !important;
|
| 492 |
font-weight: 700 !important;
|
| 493 |
background: linear-gradient(135deg, #ffffff 0%, #a855f7 50%, #3b82f6 100%) !important;
|
| 494 |
-webkit-background-clip: text !important;
|
| 495 |
-webkit-text-fill-color: transparent !important;
|
|
|
|
| 496 |
margin: 0 0 12px 0 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 497 |
}
|
| 498 |
+
|
| 499 |
.info-box {
|
| 500 |
background: rgba(255, 255, 255, 0.06) !important;
|
| 501 |
backdrop-filter: blur(16px) !important;
|
|
|
|
| 504 |
padding: 20px !important;
|
| 505 |
margin: 16px 0 !important;
|
| 506 |
color: var(--text-secondary) !important;
|
|
|
|
|
|
|
|
|
|
| 507 |
}
|
| 508 |
+
|
| 509 |
.status-box {
|
| 510 |
background: rgba(16, 185, 129, 0.1) !important;
|
|
|
|
| 511 |
border: 1px solid rgba(16, 185, 129, 0.3) !important;
|
| 512 |
border-radius: 16px !important;
|
| 513 |
padding: 16px 20px !important;
|
| 514 |
margin: 16px 0 !important;
|
| 515 |
color: #10b981 !important;
|
| 516 |
font-weight: 600 !important;
|
|
|
|
| 517 |
}
|
| 518 |
+
|
| 519 |
+
.chat-area, .tools-area {
|
| 520 |
background: var(--glass-bg) !important;
|
| 521 |
backdrop-filter: blur(20px) !important;
|
| 522 |
border: 1px solid var(--glass-border) !important;
|
| 523 |
border-radius: 20px !important;
|
| 524 |
margin: 16px 0 !important;
|
|
|
|
| 525 |
box-shadow: var(--shadow-glow) !important;
|
| 526 |
}
|
| 527 |
+
|
| 528 |
.tools-area {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
padding: 28px !important;
|
|
|
|
|
|
|
| 530 |
}
|
| 531 |
+
|
| 532 |
.tools-title {
|
| 533 |
font-size: 22px !important;
|
| 534 |
font-weight: 600 !important;
|
|
|
|
| 536 |
margin: 0 0 20px 0 !important;
|
| 537 |
padding-bottom: 12px !important;
|
| 538 |
border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 539 |
}
|
| 540 |
+
|
| 541 |
.gradio-container button {
|
| 542 |
background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%) !important;
|
| 543 |
color: var(--text-primary) !important;
|
|
|
|
| 545 |
border-radius: 12px !important;
|
| 546 |
padding: 12px 24px !important;
|
| 547 |
font-weight: 600 !important;
|
|
|
|
| 548 |
transition: all 0.3s ease !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 549 |
}
|
| 550 |
+
|
| 551 |
.gradio-container button:hover {
|
| 552 |
transform: translateY(-2px) !important;
|
| 553 |
box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6) !important;
|
|
|
|
| 554 |
}
|
| 555 |
+
|
| 556 |
+
.footer {
|
| 557 |
+
text-align: center !important;
|
| 558 |
+
padding: 28px !important;
|
| 559 |
+
color: var(--text-secondary) !important;
|
| 560 |
+
background: var(--glass-bg) !important;
|
| 561 |
+
backdrop-filter: blur(20px) !important;
|
| 562 |
+
border: 1px solid var(--glass-border) !important;
|
| 563 |
+
border-radius: 20px !important;
|
| 564 |
+
margin-top: 32px !important;
|
| 565 |
+
}
|
| 566 |
+
'''
|
| 567 |
+
|
| 568 |
+
# Create wrapper function for proper chat handling
|
| 569 |
+
def respond(message, history):
|
| 570 |
+
"""Response handler for Gradio messages format"""
|
| 571 |
+
if not message.strip():
|
| 572 |
+
return "", history
|
| 573 |
+
|
| 574 |
+
# Convert messages format to simple tuples
|
| 575 |
+
simple_history = []
|
| 576 |
+
for i in range(0, len(history), 2):
|
| 577 |
+
if i + 1 < len(history):
|
| 578 |
+
user_msg = history[i].get('content', '') if isinstance(history[i], dict) else str(history[i])
|
| 579 |
+
bot_msg = history[i + 1].get('content', '') if isinstance(history[i + 1], dict) else str(history[i + 1])
|
| 580 |
+
if user_msg and bot_msg:
|
| 581 |
+
simple_history.append([user_msg, bot_msg])
|
| 582 |
+
|
| 583 |
+
# Generate response
|
| 584 |
+
for response_chunk in creed_ai.generate_response(message, simple_history):
|
| 585 |
+
# Create new history with the streaming response
|
| 586 |
+
new_history = history + [
|
| 587 |
+
{"role": "user", "content": message},
|
| 588 |
+
{"role": "assistant", "content": response_chunk}
|
| 589 |
+
]
|
| 590 |
+
yield "", new_history
|
| 591 |
+
|
| 592 |
+
# Create the interface with modern theme
|
| 593 |
+
with gr.Blocks(
|
| 594 |
+
title="πΈ Creed Bratton AI",
|
| 595 |
+
css=modern_css,
|
| 596 |
+
theme=gr.themes.Base() # Use base theme for better CSS control
|
| 597 |
+
) as demo:
|
| 598 |
+
|
| 599 |
+
# Modern header
|
| 600 |
+
gr.HTML(f"""
|
| 601 |
+
<div class="header">
|
| 602 |
+
<h1>πΈ Creed Bratton AI</h1>
|
| 603 |
+
<p>Powered by phxdev/creed-qwen-0.5b-lora β’ Running on {'β‘ ZeroGPU' if SPACES_AVAILABLE else 'π₯οΈ CPU'}</p>
|
| 604 |
+
</div>
|
| 605 |
+
""")
|
| 606 |
+
|
| 607 |
+
# Model info with glass styling
|
| 608 |
+
gr.HTML("""
|
| 609 |
+
<div class="info-box">
|
| 610 |
+
<strong>Model:</strong> phxdev/creed-qwen-0.5b-lora<br>
|
| 611 |
+
<strong>Base:</strong> Qwen 0.5B + LoRA fine-tuning<br>
|
| 612 |
+
<strong>Tokens:</strong> <thinking>, <conspiracy>, <tangent><br>
|
| 613 |
+
<strong>Mode:</strong> ZeroGPU optimized + Coherence validation
|
| 614 |
+
</div>
|
| 615 |
+
""")
|
| 616 |
+
|
| 617 |
+
# MCP status
|
| 618 |
+
if os.environ.get('GRADIO_MCP_ENABLED'):
|
| 619 |
+
gr.HTML("""
|
| 620 |
+
<div class="status-box">
|
| 621 |
+
β MCP Server Active β’ Available as tool for Claude Desktop
|
| 622 |
+
</div>
|
| 623 |
+
""")
|
| 624 |
+
|
| 625 |
+
# Main chat interface with glass styling
|
| 626 |
+
with gr.Row(elem_classes="chat-area"):
|
| 627 |
+
chatbot = gr.Chatbot(
|
| 628 |
+
type='messages', # Use messages format (modern)
|
| 629 |
+
height=550,
|
| 630 |
+
show_copy_button=True,
|
| 631 |
+
show_share_button=False,
|
| 632 |
+
avatar_images=["π€", "πΈ"],
|
| 633 |
+
bubble_full_width=False,
|
| 634 |
+
show_label=False,
|
| 635 |
+
placeholder="πΈ Creed is ready...",
|
| 636 |
+
container=False
|
| 637 |
+
)
|
| 638 |
+
|
| 639 |
+
# Input with explicit send button
|
| 640 |
+
with gr.Row():
|
| 641 |
+
with gr.Column(scale=7):
|
| 642 |
+
msg = gr.Textbox(
|
| 643 |
+
placeholder="Ask Creed anything...",
|
| 644 |
+
container=False,
|
| 645 |
+
submit_btn=False, # Disable built-in submit
|
| 646 |
+
stop_btn=False
|
| 647 |
+
)
|
| 648 |
+
with gr.Column(scale=1, min_width=100):
|
| 649 |
+
send_btn = gr.Button("Send", variant="primary", size="lg")
|
| 650 |
+
|
| 651 |
+
# Wire up the chat - both Enter key and Send button
|
| 652 |
+
msg.submit(
|
| 653 |
+
respond,
|
| 654 |
+
inputs=[msg, chatbot],
|
| 655 |
+
outputs=[msg, chatbot],
|
| 656 |
+
show_progress="hidden"
|
| 657 |
+
)
|
| 658 |
+
|
| 659 |
+
send_btn.click(
|
| 660 |
+
respond,
|
| 661 |
+
inputs=[msg, chatbot],
|
| 662 |
+
outputs=[msg, chatbot],
|
| 663 |
+
show_progress="hidden"
|
| 664 |
+
)
|
| 665 |
+
|
| 666 |
+
# MCP Tools section with glass styling
|
| 667 |
+
with gr.Row(elem_classes="tools-area"):
|
| 668 |
+
gr.HTML('<div class="tools-title">π οΈ Claude β Creed Transformation Tools</div>')
|
| 669 |
+
gr.HTML("""
|
| 670 |
+
<div style="margin-bottom: 20px; padding: 12px; background: rgba(255,255,255,0.1); border-radius: 8px; font-size: 14px;">
|
| 671 |
+
<strong>These MCP tools transform Claude into Creed Bratton for your Claude Desktop workflow.</strong><br>
|
| 672 |
+
Test them here, then use them in Claude Desktop to get Creed-mode responses from Claude.
|
| 673 |
+
</div>
|
| 674 |
+
""")
|
| 675 |
+
|
| 676 |
+
with gr.Row():
|
| 677 |
+
with gr.Column():
|
| 678 |
+
wisdom_topic = gr.Textbox(
|
| 679 |
+
label="Wisdom Topic",
|
| 680 |
+
placeholder="life, business, relationships..."
|
| 681 |
+
)
|
| 682 |
+
wisdom_output = gr.Textbox(
|
| 683 |
+
label="Creed Wisdom Prompt (Copy to Claude Desktop)",
|
| 684 |
+
interactive=False,
|
| 685 |
+
lines=5
|
| 686 |
+
)
|
| 687 |
+
wisdom_btn = gr.Button("Generate Wisdom Prompt", variant="primary")
|
| 688 |
+
|
| 689 |
+
with gr.Column():
|
| 690 |
+
story_situation = gr.Textbox(
|
| 691 |
+
label="Story Request",
|
| 692 |
+
placeholder="mysterious, business, quarry..."
|
| 693 |
+
)
|
| 694 |
+
story_output = gr.Textbox(
|
| 695 |
+
label="Creed Story Prompt (Copy to Claude Desktop)",
|
| 696 |
+
interactive=False,
|
| 697 |
+
lines=5
|
| 698 |
+
)
|
| 699 |
+
story_btn = gr.Button("Generate Story Prompt", variant="primary")
|
| 700 |
+
|
| 701 |
+
with gr.Row():
|
| 702 |
+
with gr.Column():
|
| 703 |
+
analysis_subject = gr.Textbox(
|
| 704 |
+
label="Analysis Subject",
|
| 705 |
+
placeholder="business strategy, market trends..."
|
| 706 |
+
)
|
| 707 |
+
analysis_output = gr.Textbox(
|
| 708 |
+
label="Creed Analysis Prompt",
|
| 709 |
+
interactive=False,
|
| 710 |
+
lines=4
|
| 711 |
+
)
|
| 712 |
+
analysis_btn = gr.Button("Generate Analysis Prompt", variant="primary")
|
| 713 |
+
|
| 714 |
+
with gr.Column():
|
| 715 |
+
conspiracy_topic = gr.Textbox(
|
| 716 |
+
label="Conspiracy Topic",
|
| 717 |
+
placeholder="government, corporations, technology..."
|
| 718 |
+
)
|
| 719 |
+
conspiracy_output = gr.Textbox(
|
| 720 |
+
label="Creed Conspiracy Prompt",
|
| 721 |
+
interactive=False,
|
| 722 |
+
lines=4
|
| 723 |
+
)
|
| 724 |
+
conspiracy_btn = gr.Button("Generate Conspiracy Prompt", variant="primary")
|
| 725 |
+
|
| 726 |
+
with gr.Row():
|
| 727 |
+
activate_output = gr.Textbox(
|
| 728 |
+
label="Creed Mode Activation Prompt (Full Transformation)",
|
| 729 |
+
interactive=False,
|
| 730 |
+
lines=6
|
| 731 |
+
)
|
| 732 |
+
activate_btn = gr.Button("πΈ Generate FULL Creed Mode Prompt", variant="secondary", size="lg")
|
| 733 |
+
|
| 734 |
+
# Wire up the tools - now they're Claude transformation tools
|
| 735 |
+
wisdom_btn.click(
|
| 736 |
+
lambda topic: creed_ai.creed_wisdom_tool(topic or "life"),
|
| 737 |
+
inputs=[wisdom_topic],
|
| 738 |
+
outputs=[wisdom_output]
|
| 739 |
+
)
|
| 740 |
+
|
| 741 |
+
story_btn.click(
|
| 742 |
+
lambda situation: creed_ai.creed_story_tool(situation or "mysterious"),
|
| 743 |
+
inputs=[story_situation],
|
| 744 |
+
outputs=[story_output]
|
| 745 |
+
)
|
| 746 |
+
|
| 747 |
+
analysis_btn.click(
|
| 748 |
+
lambda subject: creed_ai.creed_analysis_tool(subject or "business"),
|
| 749 |
+
inputs=[analysis_subject],
|
| 750 |
+
outputs=[analysis_output]
|
| 751 |
+
)
|
| 752 |
+
|
| 753 |
+
conspiracy_btn.click(
|
| 754 |
+
lambda topic: creed_ai.creed_conspiracy_tool(topic or "government"),
|
| 755 |
+
inputs=[conspiracy_topic],
|
| 756 |
+
outputs=[conspiracy_output]
|
| 757 |
+
)
|
| 758 |
+
|
| 759 |
+
activate_btn.click(
|
| 760 |
+
lambda: creed_ai.creed_mode_activate_tool(),
|
| 761 |
+
outputs=[activate_output]
|
| 762 |
+
)
|
| 763 |
+
|
| 764 |
+
# Modern footer
|
| 765 |
+
gr.HTML("""
|
| 766 |
+
<div class="footer">
|
| 767 |
+
<strong>Creed Bratton AI</strong><br>
|
| 768 |
+
Model: phxdev/creed-qwen-0.5b-lora β’ Trained by Mark Scott<br>
|
| 769 |
+
<em>"Sometimes a guy's gotta ride the bull, am I right?"</em>
|
| 770 |
+
</div>
|
| 771 |
+
""")
|
| 772 |
+
|
| 773 |
+
# Launch with modern styling and public sharing
|
| 774 |
+
print("π Launching Real Creed AI with modern glassmorphism design...")
|
| 775 |
+
demo.launch(
|
| 776 |
+
ssr_mode=False,
|
| 777 |
+
server_name="0.0.0.0",
|
| 778 |
+
server_port=7860,
|
| 779 |
+
share=True, # Create public link
|
| 780 |
+
show_error=True,
|
| 781 |
+
mcp_server=True
|
| 782 |
+
)
|
| 783 |
+
|
| 784 |
+
if __name__ == "__main__":
|
| 785 |
+
main()
|