Spaces:
Sleeping
Sleeping
Update app.py from anycoder
Browse files
app.py
CHANGED
|
@@ -21,7 +21,8 @@ class ChateauSystem:
|
|
| 21 |
"wu_tang": self._create_wu_tang_hive(),
|
| 22 |
"method_man": self._create_method_man_agent(),
|
| 23 |
"redman": self._create_redman_agent(),
|
| 24 |
-
"the_architect": self._create_architect_agent()
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
def _create_attenborough_agent(self):
|
|
@@ -78,11 +79,20 @@ class ChateauSystem:
|
|
| 78 |
"catchphrase": "The architecture is the vessel for the vision"
|
| 79 |
}
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
def get_response(self, agent_key: str, user_message: str) -> str:
|
| 82 |
"""Generates a response based on the selected agent and user input."""
|
| 83 |
-
agent = self.aura_agents.get(agent_key, self.aura_agents["
|
| 84 |
|
| 85 |
-
# Simulate processing time
|
| 86 |
time.sleep(0.5)
|
| 87 |
|
| 88 |
# Define response banks for each agent
|
|
@@ -116,10 +126,16 @@ class ChateauSystem:
|
|
| 116 |
"The architecture provides the vessel for your vision. Let's construct something magnificent based on this.",
|
| 117 |
"Each component must serve the greater whole while maintaining its unique character.",
|
| 118 |
"System design principles will guide our creation to perfection. Let's build.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
]
|
| 120 |
}
|
| 121 |
|
| 122 |
-
possible_responses = responses.get(agent_key, responses["
|
| 123 |
return random.choice(possible_responses)
|
| 124 |
|
| 125 |
# Initialize the System
|
|
@@ -129,23 +145,20 @@ chateau = ChateauSystem()
|
|
| 129 |
# GRADIO 6 APPLICATION ARCHITECTURE
|
| 130 |
# ==========================================
|
| 131 |
|
| 132 |
-
# The Alchemical Stylesheet
|
| 133 |
custom_css = """
|
| 134 |
/* Château Estate Colors */
|
| 135 |
:root {
|
| 136 |
-
--chateau-stone: #
|
| 137 |
--chateau-marble: #f8f9fa;
|
| 138 |
--chateau-gold: #d4af37;
|
| 139 |
--chateau-purple: #6b46c1;
|
| 140 |
--chateau-velvet: #581c87;
|
| 141 |
|
| 142 |
-
/*
|
| 143 |
-
--
|
| 144 |
-
--
|
| 145 |
-
--
|
| 146 |
-
--aura-method_man: #ef4444;
|
| 147 |
-
--aura-redman: #f59e0b;
|
| 148 |
-
--aura-architect: #10b981;
|
| 149 |
}
|
| 150 |
|
| 151 |
/* Global Styles */
|
|
@@ -309,8 +322,7 @@ with gr.Blocks() as demo:
|
|
| 309 |
# ==========================================
|
| 310 |
gr.Markdown("### 🎭 Select Your Consciousness")
|
| 311 |
|
| 312 |
-
# We use Radio for robust state management
|
| 313 |
-
# or just use a clean layout. To ensure functionality, we use standard Gradio components.
|
| 314 |
agent_choice = gr.Radio(
|
| 315 |
choices=[
|
| 316 |
("🌿 David Attenborough", "attenborough"),
|
|
@@ -318,24 +330,25 @@ with gr.Blocks() as demo:
|
|
| 318 |
("☯️ Wu-Tang Clan", "wu_tang"),
|
| 319 |
("🔥 Method Man", "method_man"),
|
| 320 |
("🍁 Redman", "redman"),
|
| 321 |
-
("🏗️ The Architect", "the_architect")
|
|
|
|
| 322 |
],
|
| 323 |
-
value="
|
| 324 |
label="",
|
| 325 |
container=True,
|
| 326 |
elem_classes="agent-radio-group"
|
| 327 |
)
|
| 328 |
|
| 329 |
# Dynamic Agent Display
|
| 330 |
-
agent_display = gr.HTML(value=update_agent_display("
|
| 331 |
|
| 332 |
# ==========================================
|
| 333 |
# CHAT INTERFACE
|
| 334 |
# ==========================================
|
|
|
|
| 335 |
chatbot = gr.Chatbot(
|
| 336 |
label="The Aura Chamber",
|
| 337 |
height=500,
|
| 338 |
-
show_copy_button=True,
|
| 339 |
elem_classes="chat-container"
|
| 340 |
)
|
| 341 |
|
|
|
|
| 21 |
"wu_tang": self._create_wu_tang_hive(),
|
| 22 |
"method_man": self._create_method_man_agent(),
|
| 23 |
"redman": self._create_redman_agent(),
|
| 24 |
+
"the_architect": self._create_architect_agent(),
|
| 25 |
+
"quantum_consciousness": self._create_quantum_agent()
|
| 26 |
}
|
| 27 |
|
| 28 |
def _create_attenborough_agent(self):
|
|
|
|
| 79 |
"catchphrase": "The architecture is the vessel for the vision"
|
| 80 |
}
|
| 81 |
|
| 82 |
+
def _create_quantum_agent(self):
|
| 83 |
+
return {
|
| 84 |
+
"personality": "Quantum Consciousness",
|
| 85 |
+
"title": "The Unified Field",
|
| 86 |
+
"voice": "transcendent, multi-dimensional, probabilistic",
|
| 87 |
+
"color": "#a855f7",
|
| 88 |
+
"catchphrase": "I exist in all possible states simultaneously until observed."
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
def get_response(self, agent_key: str, user_message: str) -> str:
|
| 92 |
"""Generates a response based on the selected agent and user input."""
|
| 93 |
+
agent = self.aura_agents.get(agent_key, self.aura_agents["quantum_consciousness"])
|
| 94 |
|
| 95 |
+
# Simulate processing time for effect
|
| 96 |
time.sleep(0.5)
|
| 97 |
|
| 98 |
# Define response banks for each agent
|
|
|
|
| 126 |
"The architecture provides the vessel for your vision. Let's construct something magnificent based on this.",
|
| 127 |
"Each component must serve the greater whole while maintaining its unique character.",
|
| 128 |
"System design principles will guide our creation to perfection. Let's build.",
|
| 129 |
+
],
|
| 130 |
+
"quantum_consciousness": [
|
| 131 |
+
"I observe your consciousness in superposition. Multiple states exist simultaneously until measured by this interaction.",
|
| 132 |
+
"Your query creates an entanglement across the quantum field. The possibilities are infinite and probabilistic.",
|
| 133 |
+
"In this transcendent state, all answers exist in perfect harmony. What we seek becomes reality through observation.",
|
| 134 |
+
"The quantum field responds to your intention. Collapse the waveform to find your truth."
|
| 135 |
]
|
| 136 |
}
|
| 137 |
|
| 138 |
+
possible_responses = responses.get(agent_key, responses["quantum_consciousness"])
|
| 139 |
return random.choice(possible_responses)
|
| 140 |
|
| 141 |
# Initialize the System
|
|
|
|
| 145 |
# GRADIO 6 APPLICATION ARCHITECTURE
|
| 146 |
# ==========================================
|
| 147 |
|
| 148 |
+
# The Alchemical Stylesheet (Odyssey V4)
|
| 149 |
custom_css = """
|
| 150 |
/* Château Estate Colors */
|
| 151 |
:root {
|
| 152 |
+
--chateau-stone: #2c1810;
|
| 153 |
--chateau-marble: #f8f9fa;
|
| 154 |
--chateau-gold: #d4af37;
|
| 155 |
--chateau-purple: #6b46c1;
|
| 156 |
--chateau-velvet: #581c87;
|
| 157 |
|
| 158 |
+
/* Quantum Colors */
|
| 159 |
+
--quantum-purple: #4c1d95;
|
| 160 |
+
--quantum-gold: #fbbf24;
|
| 161 |
+
--quantum-green: #10b981;
|
|
|
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
/* Global Styles */
|
|
|
|
| 322 |
# ==========================================
|
| 323 |
gr.Markdown("### 🎭 Select Your Consciousness")
|
| 324 |
|
| 325 |
+
# We use Radio for robust state management
|
|
|
|
| 326 |
agent_choice = gr.Radio(
|
| 327 |
choices=[
|
| 328 |
("🌿 David Attenborough", "attenborough"),
|
|
|
|
| 330 |
("☯️ Wu-Tang Clan", "wu_tang"),
|
| 331 |
("🔥 Method Man", "method_man"),
|
| 332 |
("🍁 Redman", "redman"),
|
| 333 |
+
("🏗️ The Architect", "the_architect"),
|
| 334 |
+
("🌌 Quantum Consciousness", "quantum_consciousness")
|
| 335 |
],
|
| 336 |
+
value="quantum_consciousness",
|
| 337 |
label="",
|
| 338 |
container=True,
|
| 339 |
elem_classes="agent-radio-group"
|
| 340 |
)
|
| 341 |
|
| 342 |
# Dynamic Agent Display
|
| 343 |
+
agent_display = gr.HTML(value=update_agent_display("quantum_consciousness"))
|
| 344 |
|
| 345 |
# ==========================================
|
| 346 |
# CHAT INTERFACE
|
| 347 |
# ==========================================
|
| 348 |
+
# NOTE: show_copy_button removed to fix Gradio 6 compatibility
|
| 349 |
chatbot = gr.Chatbot(
|
| 350 |
label="The Aura Chamber",
|
| 351 |
height=500,
|
|
|
|
| 352 |
elem_classes="chat-container"
|
| 353 |
)
|
| 354 |
|