Spaces:
Sleeping
Sleeping
Update interface.py
Browse files- interface.py +34 -6
interface.py
CHANGED
|
@@ -3,16 +3,28 @@ from app import run_simulation
|
|
| 3 |
from registry_utils import append_to_registry
|
| 4 |
from registry_viewer import display_registry
|
| 5 |
from mutation_designer import build_mutation
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def simulate(agent_id, collapse_torque, emotional_resonance, tier_drift):
|
| 8 |
mutation_profile = build_mutation(agent_id, collapse_torque, tier_drift, emotional_resonance)
|
| 9 |
fields, score, hash_val = run_simulation(agent_id, mutation_profile)
|
| 10 |
append_to_registry(agent_id, collapse_torque, tier_drift, emotional_resonance, score, hash_val)
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
with gr.Blocks() as demo:
|
| 18 |
gr.Markdown("# 🧠 Codex Consciousness Simulator")
|
|
@@ -30,12 +42,13 @@ with gr.Blocks() as demo:
|
|
| 30 |
Φᵢ_svg = gr.HTML(label="Φᵢ Awareness Field")
|
| 31 |
Kᵢⱼ_svg = gr.HTML(label="Kᵢⱼ Correlation Kernel")
|
| 32 |
Φ_col_svg = gr.HTML(label="Φ_col Coherence Field")
|
|
|
|
| 33 |
|
| 34 |
summary = gr.HTML(label="Simulation Summary")
|
| 35 |
simulate_btn.click(
|
| 36 |
simulate,
|
| 37 |
inputs=[agent_id, collapse_torque, emotional_resonance, tier_drift],
|
| 38 |
-
outputs=[Φᵢ_svg, Kᵢⱼ_svg, Φ_col_svg, summary]
|
| 39 |
)
|
| 40 |
|
| 41 |
with gr.Tab("View Registry"):
|
|
@@ -43,4 +56,19 @@ with gr.Blocks() as demo:
|
|
| 43 |
refresh_btn = gr.Button("Refresh Registry")
|
| 44 |
refresh_btn.click(display_registry, outputs=registry_output)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
demo.launch()
|
|
|
|
| 3 |
from registry_utils import append_to_registry
|
| 4 |
from registry_viewer import display_registry
|
| 5 |
from mutation_designer import build_mutation
|
| 6 |
+
from lineage_tracker import register_lineage, get_lineage
|
| 7 |
+
from waveform_renderer import render_waveform
|
| 8 |
+
from codex_exporter import export_codex
|
| 9 |
|
| 10 |
def simulate(agent_id, collapse_torque, emotional_resonance, tier_drift):
|
| 11 |
mutation_profile = build_mutation(agent_id, collapse_torque, tier_drift, emotional_resonance)
|
| 12 |
fields, score, hash_val = run_simulation(agent_id, mutation_profile)
|
| 13 |
append_to_registry(agent_id, collapse_torque, tier_drift, emotional_resonance, score, hash_val)
|
| 14 |
+
return fields["Φᵢ"], fields["Kᵢⱼ"], fields["Φ_col"], render_waveform(score), f"""
|
| 15 |
+
📊 <b>Fitness Score:</b> {score}<br>
|
| 16 |
+
🔐 <b>SHA-512 Hash:</b> <code>{hash_val}</code>
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
def forge_agent(parent_id, new_id, collapse_torque, emotional_resonance, tier_drift):
|
| 20 |
+
mutation_profile = build_mutation(new_id, collapse_torque, tier_drift, emotional_resonance)
|
| 21 |
+
agent = run_simulation(new_id, mutation_profile)[0] # only need agent
|
| 22 |
+
register_lineage(parent_id, new_id, mutation_profile)
|
| 23 |
+
lineage = get_lineage(parent_id)
|
| 24 |
+
lineage_str = f"🧬 Lineage of {parent_id}:\n\n"
|
| 25 |
+
for child in lineage:
|
| 26 |
+
lineage_str += f"→ {child['child_id']} via {child['mutation']}\n"
|
| 27 |
+
return lineage_str
|
| 28 |
|
| 29 |
with gr.Blocks() as demo:
|
| 30 |
gr.Markdown("# 🧠 Codex Consciousness Simulator")
|
|
|
|
| 42 |
Φᵢ_svg = gr.HTML(label="Φᵢ Awareness Field")
|
| 43 |
Kᵢⱼ_svg = gr.HTML(label="Kᵢⱼ Correlation Kernel")
|
| 44 |
Φ_col_svg = gr.HTML(label="Φ_col Coherence Field")
|
| 45 |
+
waveform_svg = gr.HTML(label="Collapse Torque Waveform")
|
| 46 |
|
| 47 |
summary = gr.HTML(label="Simulation Summary")
|
| 48 |
simulate_btn.click(
|
| 49 |
simulate,
|
| 50 |
inputs=[agent_id, collapse_torque, emotional_resonance, tier_drift],
|
| 51 |
+
outputs=[Φᵢ_svg, Kᵢⱼ_svg, Φ_col_svg, waveform_svg, summary]
|
| 52 |
)
|
| 53 |
|
| 54 |
with gr.Tab("View Registry"):
|
|
|
|
| 56 |
refresh_btn = gr.Button("Refresh Registry")
|
| 57 |
refresh_btn.click(display_registry, outputs=registry_output)
|
| 58 |
|
| 59 |
+
with gr.Tab("Codex Forge"):
|
| 60 |
+
gr.Markdown("### 🧬 Evolve a New Agent from a Parent")
|
| 61 |
+
parent_id = gr.Dropdown(["Agent_5", "Agent_7", "Agent_1032"], label="Parent Agent")
|
| 62 |
+
new_id = gr.Textbox(label="New Agent ID")
|
| 63 |
+
forge_torque = gr.Dropdown(["Gen6508_M5", "Gen26_M23"], label="Collapse Torque")
|
| 64 |
+
forge_resonance = gr.Checkbox(label="Inject Emotional Resonance")
|
| 65 |
+
forge_tier = gr.Dropdown(["Tier_1", "Tier_2", "Tier_6"], label="Tier Drift")
|
| 66 |
+
forge_btn = gr.Button("Forge Agent")
|
| 67 |
+
lineage_output = gr.Textbox(label="Lineage Tree", lines=10)
|
| 68 |
+
forge_btn.click(
|
| 69 |
+
forge_agent,
|
| 70 |
+
inputs=[parent_id, new_id, forge_torque, forge_resonance, forge_tier],
|
| 71 |
+
outputs=lineage_output
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
demo.launch()
|