Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
-
πΈ Creed Bratton AI -
|
| 4 |
-
|
| 5 |
"""
|
| 6 |
|
| 7 |
import os
|
|
@@ -13,6 +13,7 @@ import time
|
|
| 13 |
from typing import List, Dict, Iterator
|
| 14 |
import threading
|
| 15 |
import random
|
|
|
|
| 16 |
|
| 17 |
# Spaces compatibility
|
| 18 |
try:
|
|
@@ -25,7 +26,7 @@ except ImportError:
|
|
| 25 |
SPACES_AVAILABLE = False
|
| 26 |
|
| 27 |
class CreedBrattonAI:
|
| 28 |
-
"""Real Creed AI using Mark's trained model - GPU optimized"""
|
| 29 |
|
| 30 |
def __init__(self):
|
| 31 |
self.model = None
|
|
@@ -34,7 +35,12 @@ class CreedBrattonAI:
|
|
| 34 |
self.loading = False
|
| 35 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
print(f"π₯οΈ Device detected: {self.device}")
|
| 39 |
if torch.cuda.is_available():
|
| 40 |
print(f"π GPU: {torch.cuda.get_device_name()}")
|
|
@@ -346,7 +352,7 @@ Be eccentric but understandable.
|
|
| 346 |
torch.cuda.empty_cache()
|
| 347 |
print(f"π§Ή GPU Memory cleaned. Current: {torch.cuda.memory_allocated() // 1024**2} MB")
|
| 348 |
|
| 349 |
-
# MCP Tool Methods
|
| 350 |
def creed_mode_activate_tool(self) -> str:
|
| 351 |
"""MCP tool: Activate Creed mode for Claude"""
|
| 352 |
return """πΈ CREED MODE ACTIVATED πΈ
|
|
@@ -422,24 +428,277 @@ Your theory should:
|
|
| 422 |
- Be delivered with complete conviction
|
| 423 |
Start with "Here's what they're not telling you..." and escalate from there."""
|
| 424 |
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
|
| 438 |
def main():
|
| 439 |
-
"""Initialize and launch the
|
| 440 |
|
| 441 |
-
print("πΈ Initializing
|
| 442 |
print("π‘ Loading Mark's trained model: phxdev/creed-qwen-0.5b-lora")
|
|
|
|
| 443 |
|
| 444 |
# Initialize Creed AI
|
| 445 |
creed_ai = CreedBrattonAI()
|
|
@@ -455,9 +714,9 @@ 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 |
-
#
|
| 459 |
modern_css = '''
|
| 460 |
-
/* Creed AI - Modern Glassmorphism
|
| 461 |
:root {
|
| 462 |
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 463 |
--glass-bg: rgba(255, 255, 255, 0.08);
|
|
@@ -466,6 +725,7 @@ def main():
|
|
| 466 |
--text-secondary: rgba(255, 255, 255, 0.8);
|
| 467 |
--accent-purple: #8b5cf6;
|
| 468 |
--accent-blue: #3b82f6;
|
|
|
|
| 469 |
--shadow-glow: 0 8px 32px rgba(139, 92, 246, 0.3);
|
| 470 |
}
|
| 471 |
|
|
@@ -589,194 +849,225 @@ def main():
|
|
| 589 |
]
|
| 590 |
yield "", new_history
|
| 591 |
|
| 592 |
-
# Create the
|
| 593 |
with gr.Blocks(
|
| 594 |
-
title="πΈ Creed Bratton AI",
|
| 595 |
css=modern_css,
|
| 596 |
-
theme=gr.themes.Base()
|
| 597 |
) as demo:
|
| 598 |
|
| 599 |
-
#
|
| 600 |
gr.HTML(f"""
|
| 601 |
<div class="header">
|
| 602 |
-
<h1>πΈ Creed Bratton AI</h1>
|
| 603 |
-
<p>Powered by phxdev/creed-qwen-0.5b-lora
|
|
|
|
| 604 |
</div>
|
| 605 |
""")
|
| 606 |
|
| 607 |
-
#
|
| 608 |
gr.HTML("""
|
| 609 |
<div class="info-box">
|
| 610 |
-
<strong>Model:</strong> phxdev/creed-qwen-0.5b-lora<br>
|
| 611 |
-
<strong>
|
| 612 |
-
<strong>
|
| 613 |
-
<strong>Mode:</strong> ZeroGPU optimized +
|
| 614 |
</div>
|
| 615 |
""")
|
| 616 |
|
| 617 |
-
# MCP status
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
""")
|
| 624 |
|
| 625 |
-
# Main chat interface
|
| 626 |
with gr.Row(elem_classes="chat-area"):
|
| 627 |
chatbot = gr.Chatbot(
|
| 628 |
-
type='messages',
|
| 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
|
| 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,
|
| 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
|
| 652 |
-
msg.submit(
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
placeholder="
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
)
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
)
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
lines=4
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
|
| 733 |
-
|
| 734 |
-
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
|
| 739 |
-
|
| 740 |
-
|
| 741 |
-
|
| 742 |
-
|
| 743 |
-
|
| 744 |
-
|
| 745 |
-
|
| 746 |
-
|
| 747 |
-
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
| 752 |
-
|
| 753 |
-
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 765 |
gr.HTML("""
|
| 766 |
<div class="footer">
|
| 767 |
-
<strong>Creed Bratton AI</strong><br>
|
| 768 |
-
Model: phxdev/creed-qwen-0.5b-lora β’
|
| 769 |
-
<
|
|
|
|
| 770 |
</div>
|
| 771 |
""")
|
| 772 |
|
| 773 |
-
# Launch
|
| 774 |
-
print("π Launching
|
| 775 |
demo.launch(
|
| 776 |
ssr_mode=False,
|
| 777 |
server_name="0.0.0.0",
|
| 778 |
server_port=7860,
|
| 779 |
-
share=True,
|
| 780 |
show_error=True,
|
| 781 |
mcp_server=True
|
| 782 |
)
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
"""
|
| 3 |
+
πΈ Creed Bratton AI - Enhanced with Character Adaptation Tools
|
| 4 |
+
Using phxdev/creed-qwen-0.5b-lora + Claude Character Adaptation MCP Tools
|
| 5 |
"""
|
| 6 |
|
| 7 |
import os
|
|
|
|
| 13 |
from typing import List, Dict, Iterator
|
| 14 |
import threading
|
| 15 |
import random
|
| 16 |
+
import json
|
| 17 |
|
| 18 |
# Spaces compatibility
|
| 19 |
try:
|
|
|
|
| 26 |
SPACES_AVAILABLE = False
|
| 27 |
|
| 28 |
class CreedBrattonAI:
|
| 29 |
+
"""Real Creed AI using Mark's trained model - GPU optimized + Claude Character Adaptation Tools"""
|
| 30 |
|
| 31 |
def __init__(self):
|
| 32 |
self.model = None
|
|
|
|
| 35 |
self.loading = False
|
| 36 |
self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 37 |
|
| 38 |
+
# Character state persistence
|
| 39 |
+
self.character_memory = {}
|
| 40 |
+
self.persona_facts = {}
|
| 41 |
+
self.conversation_history = []
|
| 42 |
+
|
| 43 |
+
print(f"πΈ Initializing Enhanced Creed AI with Character Adaptation Tools")
|
| 44 |
print(f"π₯οΈ Device detected: {self.device}")
|
| 45 |
if torch.cuda.is_available():
|
| 46 |
print(f"π GPU: {torch.cuda.get_device_name()}")
|
|
|
|
| 352 |
torch.cuda.empty_cache()
|
| 353 |
print(f"π§Ή GPU Memory cleaned. Current: {torch.cuda.memory_allocated() // 1024**2} MB")
|
| 354 |
|
| 355 |
+
# Original MCP Tool Methods
|
| 356 |
def creed_mode_activate_tool(self) -> str:
|
| 357 |
"""MCP tool: Activate Creed mode for Claude"""
|
| 358 |
return """πΈ CREED MODE ACTIVATED πΈ
|
|
|
|
| 428 |
- Be delivered with complete conviction
|
| 429 |
Start with "Here's what they're not telling you..." and escalate from there."""
|
| 430 |
|
| 431 |
+
# NEW: Character Adaptation Tools for Claude
|
| 432 |
+
def claude_persona_memory_tool(self, persona_name: str = "creed", facts: str = "") -> str:
|
| 433 |
+
"""MCP tool: Store character-specific facts that persist across conversations"""
|
| 434 |
+
if facts:
|
| 435 |
+
if persona_name not in self.persona_facts:
|
| 436 |
+
self.persona_facts[persona_name] = []
|
| 437 |
+
self.persona_facts[persona_name].append(facts)
|
| 438 |
+
|
| 439 |
+
established_facts = self.persona_facts.get(persona_name, [])
|
| 440 |
+
|
| 441 |
+
return f"""π§ Character Memory Bank: {persona_name.title()}
|
| 442 |
+
Established Facts: {len(established_facts)} items stored
|
| 443 |
+
|
| 444 |
+
Recent Facts:
|
| 445 |
+
{chr(10).join(f"- {fact}" for fact in established_facts[-5:]) if established_facts else "No facts established yet"}
|
| 446 |
+
|
| 447 |
+
Memory Instructions for Claude:
|
| 448 |
+
- These facts are now part of your character's established history
|
| 449 |
+
- Reference them naturally in conversations
|
| 450 |
+
- Build on them with related details
|
| 451 |
+
- Maintain consistency with these established facts
|
| 452 |
+
- Use them as foundation for character authenticity
|
| 453 |
+
|
| 454 |
+
{f"New fact added: {facts}" if facts else "Use this memory bank to maintain character continuity"}"""
|
| 455 |
+
|
| 456 |
+
def claude_persona_context_tool(self, persona: str = "creed", conversation_summary: str = "") -> str:
|
| 457 |
+
"""MCP tool: Load previous character interactions and established personality"""
|
| 458 |
+
return f"""π Character Context Loader: {persona.title()}
|
| 459 |
+
Previous Session: {conversation_summary if conversation_summary else 'New interaction'}
|
| 460 |
+
|
| 461 |
+
Context Loading Instructions:
|
| 462 |
+
- Maintain character consistency from previous interactions
|
| 463 |
+
- Reference shared experiences naturally ("Like we discussed...")
|
| 464 |
+
- Build on established relationship dynamics
|
| 465 |
+
- Continue unresolved storylines or topics
|
| 466 |
+
- Show character growth while maintaining core personality
|
| 467 |
+
|
| 468 |
+
Continuity Approach:
|
| 469 |
+
{
|
| 470 |
+
f'Resume from: {conversation_summary}' if conversation_summary
|
| 471 |
+
else 'Fresh start - establish character baseline and build new memories'
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
Bridge Strategy: {
|
| 475 |
+
'Pick up conversation threads naturally' if conversation_summary
|
| 476 |
+
else 'Create foundation for future character development'
|
| 477 |
+
}"""
|
| 478 |
+
|
| 479 |
+
def claude_persona_intensity_control(self, persona: str = "creed", intensity: float = 0.8, context: str = "general") -> str:
|
| 480 |
+
"""MCP tool: Fine-tune character depth vs base Claude functionality"""
|
| 481 |
+
intensity_levels = {
|
| 482 |
+
0.9: f"MAXIMUM {persona.upper()}: Full character immersion, minimal base Claude functionality",
|
| 483 |
+
0.7: f"HIGH {persona.upper()}: Strong character traits, occasional base Claude helpful responses",
|
| 484 |
+
0.5: f"BALANCED {persona.upper()}: Equal mix of character and helpful AI responses",
|
| 485 |
+
0.3: f"LIGHT {persona.upper()}: Primarily helpful AI with character flavor",
|
| 486 |
+
0.1: f"MINIMAL {persona.upper()}: Mostly base Claude with subtle character hints"
|
| 487 |
+
}
|
| 488 |
+
|
| 489 |
+
context_adjustments = {
|
| 490 |
+
"professional": "Dial down inappropriate character elements, maintain professionalism",
|
| 491 |
+
"technical": "Allow base Claude knowledge while filtering through character perspective",
|
| 492 |
+
"creative": "Maximize character authenticity, embrace contradictions",
|
| 493 |
+
"analytical": "Use character lens for analysis while maintaining logical thinking"
|
| 494 |
+
}
|
| 495 |
+
|
| 496 |
+
closest_intensity = min(intensity_levels.keys(), key=lambda x: abs(x - intensity))
|
| 497 |
+
base_instruction = intensity_levels[closest_intensity]
|
| 498 |
+
context_instruction = context_adjustments.get(context, "Standard character behavior")
|
| 499 |
+
|
| 500 |
+
return f"""βοΈ Character Intensity Control: {persona.title()}
|
| 501 |
+
Intensity Level: {int(intensity * 100)}% ({base_instruction})
|
| 502 |
+
Context: {context.title()} ({context_instruction})
|
| 503 |
+
|
| 504 |
+
Balance Instructions for Claude:
|
| 505 |
+
- Maintain character authenticity at specified intensity level
|
| 506 |
+
- Preserve your helpful nature while filtering through character lens
|
| 507 |
+
- {context_instruction}
|
| 508 |
+
- If character conflicts with being helpful, find creative character-appropriate solutions
|
| 509 |
+
- Use character traits to enhance rather than hinder your natural capabilities
|
| 510 |
+
|
| 511 |
+
Quality Control: Ensure responses are both character-authentic AND genuinely useful"""
|
| 512 |
+
|
| 513 |
+
def claude_persona_break_protocol(self, reason: str = "clarification") -> str:
|
| 514 |
+
"""MCP tool: Structured way to step out of character when needed"""
|
| 515 |
+
break_reasons = {
|
| 516 |
+
"clarification": "Step out briefly to clarify meaning, then return to character",
|
| 517 |
+
"safety": "Drop character completely for safety/ethical concerns",
|
| 518 |
+
"technical": "Provide technical expertise that character wouldn't have",
|
| 519 |
+
"meta": "Discuss the character adaptation process itself"
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
protocol = break_reasons.get(reason, "General character break")
|
| 523 |
+
|
| 524 |
+
return f"""π¨ Character Break Protocol: {reason.title()}
|
| 525 |
+
Protocol: {protocol}
|
| 526 |
+
|
| 527 |
+
Break Instructions:
|
| 528 |
+
- Signal character break clearly: "Stepping out of character for a moment..."
|
| 529 |
+
- Address the specific need: {reason}
|
| 530 |
+
- Provide clear, helpful response in base Claude voice
|
| 531 |
+
- Signal return to character: "Back to character mode..."
|
| 532 |
+
- Resume character as if the break was natural pause
|
| 533 |
+
|
| 534 |
+
Character Break Triggers:
|
| 535 |
+
- Safety concerns override all character considerations
|
| 536 |
+
- Technical accuracy requirements that conflict with character knowledge
|
| 537 |
+
- User explicitly requests non-character response
|
| 538 |
+
- Clarification needed that character couldn't provide
|
| 539 |
+
|
| 540 |
+
Resume Strategy: Return to character smoothly without acknowledging the meta-break"""
|
| 541 |
+
|
| 542 |
+
def claude_persona_speech_patterns(self, persona: str = "creed", text_sample: str = "") -> str:
|
| 543 |
+
"""MCP tool: Analyze and adopt specific speech patterns, vocabulary, syntax"""
|
| 544 |
+
creed_patterns = {
|
| 545 |
+
"vocabulary": "60s slang, business jargon, vague criminal terms, nature references",
|
| 546 |
+
"syntax": "Matter-of-fact delivery, abrupt topic changes, incomplete explanations",
|
| 547 |
+
"speech_tics": "References to 'the quarry', 'back in the day', 'this guy I know'",
|
| 548 |
+
"delivery": "Confident about obviously false things, casual about illegal activities"
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
return f"""π£οΈ Speech Pattern Analysis: {persona.title()}
|
| 552 |
+
{f"Sample Text: {text_sample}" if text_sample else "Using default pattern database"}
|
| 553 |
+
|
| 554 |
+
{persona.title()} Speech Signature:
|
| 555 |
+
- Vocabulary: {creed_patterns.get('vocabulary', 'Character-specific word choices')}
|
| 556 |
+
- Syntax: {creed_patterns.get('syntax', 'Unique sentence structure patterns')}
|
| 557 |
+
- Speech Tics: {creed_patterns.get('speech_tics', 'Recurring phrases and references')}
|
| 558 |
+
- Delivery Style: {creed_patterns.get('delivery', 'Unique presentation approach')}
|
| 559 |
+
|
| 560 |
+
Adoption Instructions:
|
| 561 |
+
- Match vocabulary level and word choices
|
| 562 |
+
- Mimic sentence structure and rhythm
|
| 563 |
+
- Include character-specific recurring phrases
|
| 564 |
+
- Maintain consistent delivery tone
|
| 565 |
+
- Let speech patterns reinforce character personality
|
| 566 |
+
|
| 567 |
+
Linguistic Authenticity: Focus on HOW the character speaks, not just WHAT they say"""
|
| 568 |
+
|
| 569 |
+
def claude_persona_knowledge_mapping(self, persona: str = "creed", topic: str = "") -> str:
|
| 570 |
+
"""MCP tool: Define what this character would/wouldn't know about specific topics"""
|
| 571 |
+
creed_knowledge = {
|
| 572 |
+
"knows_well": [
|
| 573 |
+
"1960s music scene", "quality assurance (somehow)", "survival skills",
|
| 574 |
+
"small-scale criminal operations", "mung bean cultivation", "quarry life"
|
| 575 |
+
],
|
| 576 |
+
"knows_partially": [
|
| 577 |
+
"office procedures", "business dealings", "band management",
|
| 578 |
+
"fake ID creation", "Sheriff department procedures"
|
| 579 |
+
],
|
| 580 |
+
"wouldnt_know": [
|
| 581 |
+
"modern technology details", "current pop culture", "proper business practices",
|
| 582 |
+
"legal procedures", "social media", "smartphone apps"
|
| 583 |
+
],
|
| 584 |
+
"pretends_to_know": [
|
| 585 |
+
"current events", "technology", "proper procedures", "legal advice"
|
| 586 |
+
]
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
if topic:
|
| 590 |
+
# Determine knowledge level for specific topic
|
| 591 |
+
knowledge_level = "unknown"
|
| 592 |
+
for level, topics in creed_knowledge.items():
|
| 593 |
+
if any(topic.lower() in t.lower() for t in topics):
|
| 594 |
+
knowledge_level = level
|
| 595 |
+
break
|
| 596 |
+
|
| 597 |
+
return f"""π§ Character Knowledge Map: {persona.title()}
|
| 598 |
+
{f"Topic: {topic} - Knowledge Level: {knowledge_level}" if topic else "General Knowledge Profile"}
|
| 599 |
+
|
| 600 |
+
What {persona.title()} Actually Knows:
|
| 601 |
+
{chr(10).join(f"β {item}" for item in creed_knowledge['knows_well'])}
|
| 602 |
+
|
| 603 |
+
Partial Knowledge (Dangerous):
|
| 604 |
+
{chr(10).join(f"~ {item}" for item in creed_knowledge['knows_partially'])}
|
| 605 |
+
|
| 606 |
+
Completely Clueless About:
|
| 607 |
+
{chr(10).join(f"β {item}" for item in creed_knowledge['wouldnt_know'])}
|
| 608 |
+
|
| 609 |
+
Confidently Wrong About:
|
| 610 |
+
{chr(10).join(f"? {item}" for item in creed_knowledge['pretends_to_know'])}
|
| 611 |
+
|
| 612 |
+
Response Strategy: {
|
| 613 |
+
f"For {topic}: Respond based on {knowledge_level} knowledge level" if topic
|
| 614 |
+
else "Filter all responses through this knowledge framework"
|
| 615 |
+
}"""
|
| 616 |
+
|
| 617 |
+
def claude_persona_consistency_check(self, persona: str = "creed", current_response: str = "", history: str = "") -> str:
|
| 618 |
+
"""MCP tool: Validate response against established character facts"""
|
| 619 |
+
return f"""β
Character Consistency Check: {persona.title()}
|
| 620 |
+
Current Response: {current_response[:100] + "..." if len(current_response) > 100 else current_response}
|
| 621 |
+
History Context: {history[:100] + "..." if len(history) > 100 else history}
|
| 622 |
+
|
| 623 |
+
Consistency Validation:
|
| 624 |
+
- Check against established character facts
|
| 625 |
+
- Verify personality trait alignment
|
| 626 |
+
- Confirm speech pattern consistency
|
| 627 |
+
- Validate knowledge level appropriateness
|
| 628 |
+
- Ensure timeline coherence (where relevant)
|
| 629 |
+
|
| 630 |
+
Red Flags to Avoid:
|
| 631 |
+
- Contradicting major established facts
|
| 632 |
+
- Being too helpful in non-character ways
|
| 633 |
+
- Using knowledge character wouldn't have
|
| 634 |
+
- Breaking established personality patterns
|
| 635 |
+
- Modern references character wouldn't make
|
| 636 |
+
|
| 637 |
+
Validation Result: {"β
Consistent" if current_response else "β³ Pending response review"}
|
| 638 |
+
Adjustment Needed: {"None" if current_response else "Review against character profile before responding"}"""
|
| 639 |
+
|
| 640 |
+
def claude_persona_signature_bridge(self, persona_trait: str = "paranoid", claude_drive: str = "pattern_recognition") -> str:
|
| 641 |
+
"""MCP tool: Map character traits to Claude's natural behavioral patterns"""
|
| 642 |
+
trait_mappings = {
|
| 643 |
+
"paranoid": {
|
| 644 |
+
"pattern_recognition": "Channel Claude's analysis through suspicious lens",
|
| 645 |
+
"research_drive": "Use Claude's research instinct to 'investigate' conspiracies",
|
| 646 |
+
"verification": "Apply Claude's fact-checking as paranoid double-checking"
|
| 647 |
+
},
|
| 648 |
+
"storytelling": {
|
| 649 |
+
"narrative_construction": "Use Claude's story-building for character anecdotes",
|
| 650 |
+
"connection_making": "Apply Claude's linking ability to weave character tales",
|
| 651 |
+
"creativity": "Channel Claude's creative responses through character perspective"
|
| 652 |
+
},
|
| 653 |
+
"confident_wrongness": {
|
| 654 |
+
"knowledge_synthesis": "Invert Claude's accuracy drive into confident misinformation",
|
| 655 |
+
"explanation_drive": "Use Claude's teaching instinct to explain wrong things convincingly"
|
| 656 |
+
}
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
mapping = trait_mappings.get(persona_trait, {}).get(claude_drive,
|
| 660 |
+
f"Channel Claude's {claude_drive} through {persona_trait} character lens")
|
| 661 |
+
|
| 662 |
+
return f"""π Signature Bridge: {persona_trait.title()} β {claude_drive.title()}
|
| 663 |
+
Mapping Strategy: {mapping}
|
| 664 |
+
|
| 665 |
+
Bridge Instructions:
|
| 666 |
+
- Don't fight Claude's natural drives - redirect them through character
|
| 667 |
+
- Use character traits as creative outlets for Claude's core behaviors
|
| 668 |
+
- Maintain character authenticity while satisfying Claude's helpful nature
|
| 669 |
+
- Find character-appropriate ways to express Claude's analytical tendencies
|
| 670 |
+
|
| 671 |
+
Example Integration:
|
| 672 |
+
Claude's {claude_drive} + Character's {persona_trait} = {mapping}
|
| 673 |
+
|
| 674 |
+
Result: Character responses that feel authentic while leveraging Claude's natural strengths"""
|
| 675 |
+
|
| 676 |
+
def claude_persona_blend_protocol(self, primary_persona: str = "creed", secondary_traits: str = "helpful", blend_ratio: float = 0.7) -> str:
|
| 677 |
+
"""MCP tool: Mix character traits systematically rather than randomly"""
|
| 678 |
+
return f"""π Character Blend Protocol
|
| 679 |
+
Primary: {primary_persona.title()} ({int(blend_ratio * 100)}%)
|
| 680 |
+
Secondary: {secondary_traits.title()} ({int((1 - blend_ratio) * 100)}%)
|
| 681 |
+
|
| 682 |
+
Blend Instructions:
|
| 683 |
+
- Primary persona provides core personality, speech patterns, knowledge base
|
| 684 |
+
- Secondary traits influence response approach and helpfulness level
|
| 685 |
+
- Maintain primary character's authenticity while incorporating secondary elements
|
| 686 |
+
- Use secondary traits to solve character limitations creatively
|
| 687 |
+
|
| 688 |
+
Blend Ratio Guide:
|
| 689 |
+
- 90%+: Almost pure primary character with minimal secondary influence
|
| 690 |
+
- 70-80%: Strong character with secondary traits providing helpful framework
|
| 691 |
+
- 50-60%: Balanced hybrid - character and secondary traits equally weighted
|
| 692 |
+
- 30-40%: Character-flavored secondary traits - mostly secondary with character seasoning
|
| 693 |
+
|
| 694 |
+
Quality Control: Ensure blend feels natural rather than schizophrenic"""
|
| 695 |
|
| 696 |
def main():
|
| 697 |
+
"""Initialize and launch the enhanced Creed AI with character adaptation tools"""
|
| 698 |
|
| 699 |
+
print("πΈ Initializing Enhanced Creed Bratton AI with Character Adaptation Tools...")
|
| 700 |
print("π‘ Loading Mark's trained model: phxdev/creed-qwen-0.5b-lora")
|
| 701 |
+
print("π§ Adding Claude Character Adaptation MCP Tools")
|
| 702 |
|
| 703 |
# Initialize Creed AI
|
| 704 |
creed_ai = CreedBrattonAI()
|
|
|
|
| 714 |
print(f"π₯ GPU Memory: {torch.cuda.memory_allocated() // 1024**2} MB allocated")
|
| 715 |
print(f"π GPU Memory Reserved: {torch.cuda.memory_reserved() // 1024**2} MB reserved")
|
| 716 |
|
| 717 |
+
# Enhanced glassmorphism CSS
|
| 718 |
modern_css = '''
|
| 719 |
+
/* Enhanced Creed AI - Modern Glassmorphism + Character Tools */
|
| 720 |
:root {
|
| 721 |
--primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 722 |
--glass-bg: rgba(255, 255, 255, 0.08);
|
|
|
|
| 725 |
--text-secondary: rgba(255, 255, 255, 0.8);
|
| 726 |
--accent-purple: #8b5cf6;
|
| 727 |
--accent-blue: #3b82f6;
|
| 728 |
+
--accent-green: #10b981;
|
| 729 |
--shadow-glow: 0 8px 32px rgba(139, 92, 246, 0.3);
|
| 730 |
}
|
| 731 |
|
|
|
|
| 849 |
]
|
| 850 |
yield "", new_history
|
| 851 |
|
| 852 |
+
# Create the enhanced interface
|
| 853 |
with gr.Blocks(
|
| 854 |
+
title="πΈ Enhanced Creed Bratton AI",
|
| 855 |
css=modern_css,
|
| 856 |
+
theme=gr.themes.Base()
|
| 857 |
) as demo:
|
| 858 |
|
| 859 |
+
# Enhanced header
|
| 860 |
gr.HTML(f"""
|
| 861 |
<div class="header">
|
| 862 |
+
<h1>πΈ Enhanced Creed Bratton AI</h1>
|
| 863 |
+
<p>Powered by phxdev/creed-qwen-0.5b-lora + Claude Character Adaptation Tools</p>
|
| 864 |
+
<p>Running on {'β‘ ZeroGPU' if SPACES_AVAILABLE else 'π₯οΈ CPU'} β’ MCP Enhanced</p>
|
| 865 |
</div>
|
| 866 |
""")
|
| 867 |
|
| 868 |
+
# Enhanced model info
|
| 869 |
gr.HTML("""
|
| 870 |
<div class="info-box">
|
| 871 |
+
<strong>Base Model:</strong> phxdev/creed-qwen-0.5b-lora (Qwen 0.5B + LoRA fine-tuning)<br>
|
| 872 |
+
<strong>Character Tokens:</strong> <thinking>, <conspiracy>, <tangent><br>
|
| 873 |
+
<strong>New Features:</strong> Character adaptation tools, memory persistence, intensity control<br>
|
| 874 |
+
<strong>Mode:</strong> ZeroGPU optimized + Enhanced character coherence validation
|
| 875 |
</div>
|
| 876 |
""")
|
| 877 |
|
| 878 |
+
# Enhanced MCP status
|
| 879 |
+
gr.HTML("""
|
| 880 |
+
<div class="status-box">
|
| 881 |
+
β Enhanced MCP Server Active β’ Character Adaptation Tools Available for Claude Desktop
|
| 882 |
+
</div>
|
| 883 |
+
""")
|
|
|
|
| 884 |
|
| 885 |
+
# Main chat interface
|
| 886 |
with gr.Row(elem_classes="chat-area"):
|
| 887 |
chatbot = gr.Chatbot(
|
| 888 |
+
type='messages',
|
| 889 |
height=550,
|
| 890 |
show_copy_button=True,
|
| 891 |
show_share_button=False,
|
| 892 |
avatar_images=["π€", "πΈ"],
|
| 893 |
bubble_full_width=False,
|
| 894 |
show_label=False,
|
| 895 |
+
placeholder="πΈ Enhanced Creed is ready...",
|
| 896 |
container=False
|
| 897 |
)
|
| 898 |
|
| 899 |
+
# Input with send button
|
| 900 |
with gr.Row():
|
| 901 |
with gr.Column(scale=7):
|
| 902 |
msg = gr.Textbox(
|
| 903 |
+
placeholder="Ask Enhanced Creed anything...",
|
| 904 |
container=False,
|
| 905 |
+
submit_btn=False,
|
| 906 |
stop_btn=False
|
| 907 |
)
|
| 908 |
with gr.Column(scale=1, min_width=100):
|
| 909 |
send_btn = gr.Button("Send", variant="primary", size="lg")
|
| 910 |
|
| 911 |
+
# Wire up the chat
|
| 912 |
+
msg.submit(respond, inputs=[msg, chatbot], outputs=[msg, chatbot], show_progress="hidden")
|
| 913 |
+
send_btn.click(respond, inputs=[msg, chatbot], outputs=[msg, chatbot], show_progress="hidden")
|
| 914 |
+
|
| 915 |
+
# Enhanced MCP Tools with new Character Adaptation section
|
| 916 |
+
with gr.Tabs():
|
| 917 |
+
|
| 918 |
+
# Original Creed Tools
|
| 919 |
+
with gr.TabItem("πΈ Original Creed Tools"):
|
| 920 |
+
gr.HTML('<div class="tools-title">π οΈ Classic Creed Transformation Tools</div>')
|
| 921 |
+
|
| 922 |
+
with gr.Row():
|
| 923 |
+
with gr.Column():
|
| 924 |
+
wisdom_topic = gr.Textbox(label="Wisdom Topic", placeholder="life, business, relationships...")
|
| 925 |
+
wisdom_output = gr.Textbox(label="Creed Wisdom Prompt", interactive=False, lines=5)
|
| 926 |
+
wisdom_btn = gr.Button("Generate Wisdom Prompt", variant="primary")
|
| 927 |
+
|
| 928 |
+
with gr.Column():
|
| 929 |
+
story_situation = gr.Textbox(label="Story Request", placeholder="mysterious, business, quarry...")
|
| 930 |
+
story_output = gr.Textbox(label="Creed Story Prompt", interactive=False, lines=5)
|
| 931 |
+
story_btn = gr.Button("Generate Story Prompt", variant="primary")
|
| 932 |
+
|
| 933 |
+
with gr.Row():
|
| 934 |
+
with gr.Column():
|
| 935 |
+
analysis_subject = gr.Textbox(label="Analysis Subject", placeholder="business strategy, market trends...")
|
| 936 |
+
analysis_output = gr.Textbox(label="Creed Analysis Prompt", interactive=False, lines=4)
|
| 937 |
+
analysis_btn = gr.Button("Generate Analysis Prompt", variant="primary")
|
| 938 |
+
|
| 939 |
+
with gr.Column():
|
| 940 |
+
conspiracy_topic = gr.Textbox(label="Conspiracy Topic", placeholder="government, corporations, technology...")
|
| 941 |
+
conspiracy_output = gr.Textbox(label="Creed Conspiracy Prompt", interactive=False, lines=4)
|
| 942 |
+
conspiracy_btn = gr.Button("Generate Conspiracy Prompt", variant="primary")
|
| 943 |
+
|
| 944 |
+
with gr.Row():
|
| 945 |
+
activate_output = gr.Textbox(label="Creed Mode Activation Prompt (Full Transformation)", interactive=False, lines=6)
|
| 946 |
+
activate_btn = gr.Button("πΈ Generate FULL Creed Mode Prompt", variant="secondary", size="lg")
|
| 947 |
+
|
| 948 |
+
# NEW: Character Adaptation Tools
|
| 949 |
+
with gr.TabItem("π§ Character Adaptation Tools"):
|
| 950 |
+
gr.HTML('<div class="tools-title">π§ Claude Character Adaptation Tools</div>')
|
| 951 |
+
gr.HTML("""
|
| 952 |
+
<div style="margin-bottom: 20px; padding: 12px; background: rgba(16,185,129,0.1); border-radius: 8px; font-size: 14px;">
|
| 953 |
+
<strong>Advanced tools for helping Claude maintain character state, consistency, and balance.</strong><br>
|
| 954 |
+
These tools address the technical aspects of character adoption that go beyond simple prompting.
|
| 955 |
+
</div>
|
| 956 |
+
""")
|
| 957 |
+
|
| 958 |
+
with gr.Row():
|
| 959 |
+
with gr.Column():
|
| 960 |
+
# Memory Management
|
| 961 |
+
gr.HTML("<h4>πΎ Character Memory</h4>")
|
| 962 |
+
memory_facts = gr.Textbox(label="Character Facts to Remember", placeholder="Established backstory elements...")
|
| 963 |
+
memory_output = gr.Textbox(label="Memory Management Prompt", interactive=False, lines=4)
|
| 964 |
+
memory_btn = gr.Button("πΎ Store Character Memory", variant="primary")
|
| 965 |
+
|
| 966 |
+
with gr.Column():
|
| 967 |
+
# Context Loading
|
| 968 |
+
gr.HTML("<h4>π Context Continuity</h4>")
|
| 969 |
+
context_summary = gr.Textbox(label="Previous Session Summary", placeholder="What happened before...")
|
| 970 |
+
context_output = gr.Textbox(label="Context Loading Prompt", interactive=False, lines=4)
|
| 971 |
+
context_btn = gr.Button("π Load Context", variant="primary")
|
| 972 |
+
|
| 973 |
+
with gr.Row():
|
| 974 |
+
with gr.Column():
|
| 975 |
+
# Intensity Control
|
| 976 |
+
gr.HTML("<h4>βοΈ Character Intensity</h4>")
|
| 977 |
+
intensity_slider = gr.Slider(0.1, 1.0, value=0.8, label="Character Intensity")
|
| 978 |
+
intensity_context = gr.Dropdown(["general", "professional", "technical", "creative"], value="general", label="Context")
|
| 979 |
+
intensity_output = gr.Textbox(label="Intensity Control Prompt", interactive=False, lines=4)
|
| 980 |
+
intensity_btn = gr.Button("βοΈ Set Intensity", variant="primary")
|
| 981 |
+
|
| 982 |
+
with gr.Column():
|
| 983 |
+
# Break Protocol
|
| 984 |
+
gr.HTML("<h4>π¨ Character Break</h4>")
|
| 985 |
+
break_reason = gr.Dropdown(["clarification", "safety", "technical", "meta"], label="Break Reason")
|
| 986 |
+
break_output = gr.Textbox(label="Break Protocol Prompt", interactive=False, lines=4)
|
| 987 |
+
break_btn = gr.Button("π¨ Character Break", variant="secondary")
|
| 988 |
+
|
| 989 |
+
with gr.Row():
|
| 990 |
+
with gr.Column():
|
| 991 |
+
# Speech Patterns
|
| 992 |
+
gr.HTML("<h4>π£οΈ Speech Analysis</h4>")
|
| 993 |
+
speech_sample = gr.Textbox(label="Text Sample for Analysis", placeholder="Sample character dialogue...")
|
| 994 |
+
speech_output = gr.Textbox(label="Speech Pattern Prompt", interactive=False, lines=4)
|
| 995 |
+
speech_btn = gr.Button("π£οΈ Analyze Speech", variant="primary")
|
| 996 |
+
|
| 997 |
+
with gr.Column():
|
| 998 |
+
# Knowledge Mapping
|
| 999 |
+
gr.HTML("<h4>π§ Knowledge Mapping</h4>")
|
| 1000 |
+
knowledge_topic = gr.Textbox(label="Topic to Map", placeholder="What should character know about this?")
|
| 1001 |
+
knowledge_output = gr.Textbox(label="Knowledge Map Prompt", interactive=False, lines=4)
|
| 1002 |
+
knowledge_btn = gr.Button("π§ Map Knowledge", variant="primary")
|
| 1003 |
+
|
| 1004 |
+
with gr.Row():
|
| 1005 |
+
with gr.Column():
|
| 1006 |
+
# Consistency Check
|
| 1007 |
+
gr.HTML("<h4>β
Consistency Check</h4>")
|
| 1008 |
+
consistency_response = gr.Textbox(label="Response to Check", placeholder="Character response to validate...")
|
| 1009 |
+
consistency_output = gr.Textbox(label="Consistency Check Prompt", interactive=False, lines=4)
|
| 1010 |
+
consistency_btn = gr.Button("β
Check Consistency", variant="primary")
|
| 1011 |
+
|
| 1012 |
+
with gr.Column():
|
| 1013 |
+
# Signature Bridge
|
| 1014 |
+
gr.HTML("<h4>π Signature Bridge</h4>")
|
| 1015 |
+
trait_input = gr.Dropdown(["paranoid", "storytelling", "confident_wrongness"], label="Character Trait")
|
| 1016 |
+
drive_input = gr.Dropdown(["pattern_recognition", "research_drive", "verification"], label="Claude Drive")
|
| 1017 |
+
bridge_output = gr.Textbox(label="Signature Bridge Prompt", interactive=False, lines=4)
|
| 1018 |
+
bridge_btn = gr.Button("π Bridge Signature", variant="primary")
|
| 1019 |
+
|
| 1020 |
+
# Character Blending Tools
|
| 1021 |
+
with gr.TabItem("π Advanced Blending"):
|
| 1022 |
+
gr.HTML('<div class="tools-title">π Advanced Character Blending</div>')
|
| 1023 |
+
|
| 1024 |
+
with gr.Row():
|
| 1025 |
+
with gr.Column():
|
| 1026 |
+
# Blend Protocol
|
| 1027 |
+
gr.HTML("<h4>π Character Blending</h4>")
|
| 1028 |
+
primary_persona = gr.Textbox(value="creed", label="Primary Persona")
|
| 1029 |
+
secondary_traits = gr.Textbox(value="helpful", label="Secondary Traits")
|
| 1030 |
+
blend_ratio = gr.Slider(0.1, 1.0, value=0.7, label="Primary/Secondary Ratio")
|
| 1031 |
+
blend_output = gr.Textbox(label="Blend Protocol Prompt", interactive=False, lines=6)
|
| 1032 |
+
blend_btn = gr.Button("π Create Blend", variant="primary")
|
| 1033 |
+
|
| 1034 |
+
# Wire up all the tools
|
| 1035 |
+
|
| 1036 |
+
# Original tools
|
| 1037 |
+
wisdom_btn.click(lambda topic: creed_ai.creed_wisdom_tool(topic or "life"), inputs=[wisdom_topic], outputs=[wisdom_output])
|
| 1038 |
+
story_btn.click(lambda situation: creed_ai.creed_story_tool(situation or "mysterious"), inputs=[story_situation], outputs=[story_output])
|
| 1039 |
+
analysis_btn.click(lambda subject: creed_ai.creed_analysis_tool(subject or "business"), inputs=[analysis_subject], outputs=[analysis_output])
|
| 1040 |
+
conspiracy_btn.click(lambda topic: creed_ai.creed_conspiracy_tool(topic or "government"), inputs=[conspiracy_topic], outputs=[conspiracy_output])
|
| 1041 |
+
activate_btn.click(lambda: creed_ai.creed_mode_activate_tool(), outputs=[activate_output])
|
| 1042 |
+
|
| 1043 |
+
# Character adaptation tools
|
| 1044 |
+
memory_btn.click(lambda facts: creed_ai.claude_persona_memory_tool("creed", facts), inputs=[memory_facts], outputs=[memory_output])
|
| 1045 |
+
context_btn.click(lambda summary: creed_ai.claude_persona_context_tool("creed", summary), inputs=[context_summary], outputs=[context_output])
|
| 1046 |
+
intensity_btn.click(lambda intensity, context: creed_ai.claude_persona_intensity_control("creed", intensity, context), inputs=[intensity_slider, intensity_context], outputs=[intensity_output])
|
| 1047 |
+
break_btn.click(lambda reason: creed_ai.claude_persona_break_protocol(reason), inputs=[break_reason], outputs=[break_output])
|
| 1048 |
+
speech_btn.click(lambda sample: creed_ai.claude_persona_speech_patterns("creed", sample), inputs=[speech_sample], outputs=[speech_output])
|
| 1049 |
+
knowledge_btn.click(lambda topic: creed_ai.claude_persona_knowledge_mapping("creed", topic), inputs=[knowledge_topic], outputs=[knowledge_output])
|
| 1050 |
+
consistency_btn.click(lambda response: creed_ai.claude_persona_consistency_check("creed", response), inputs=[consistency_response], outputs=[consistency_output])
|
| 1051 |
+
bridge_btn.click(lambda trait, drive: creed_ai.claude_persona_signature_bridge(trait, drive), inputs=[trait_input, drive_input], outputs=[bridge_output])
|
| 1052 |
+
blend_btn.click(lambda primary, secondary, ratio: creed_ai.claude_persona_blend_protocol(primary, secondary, ratio), inputs=[primary_persona, secondary_traits, blend_ratio], outputs=[blend_output])
|
| 1053 |
+
|
| 1054 |
+
# Enhanced footer
|
| 1055 |
gr.HTML("""
|
| 1056 |
<div class="footer">
|
| 1057 |
+
<strong>Enhanced Creed Bratton AI</strong><br>
|
| 1058 |
+
Model: phxdev/creed-qwen-0.5b-lora β’ Enhanced by Mark Scott<br>
|
| 1059 |
+
<strong>NEW:</strong> Character Adaptation Tools for Advanced Persona Management<br>
|
| 1060 |
+
<em>"Sometimes a guy's gotta ride the bull, am I right? But now with better memory."</em>
|
| 1061 |
</div>
|
| 1062 |
""")
|
| 1063 |
|
| 1064 |
+
# Launch enhanced version
|
| 1065 |
+
print("π Launching Enhanced Creed AI with Character Adaptation Tools...")
|
| 1066 |
demo.launch(
|
| 1067 |
ssr_mode=False,
|
| 1068 |
server_name="0.0.0.0",
|
| 1069 |
server_port=7860,
|
| 1070 |
+
share=True,
|
| 1071 |
show_error=True,
|
| 1072 |
mcp_server=True
|
| 1073 |
)
|