coredipper commited on
Commit
32493ef
·
verified ·
1 Parent(s): d8755bd

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +8 -6
  2. app.py +142 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -1,12 +1,14 @@
1
  ---
2
- title: Operon Development
3
- emoji: 🐨
4
- colorFrom: indigo
5
- colorTo: pink
6
  sdk: gradio
7
- sdk_version: 6.9.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Operon Developmental Staging
3
+ emoji: 🌱
4
+ colorFrom: green
5
+ colorTo: purple
6
  sdk: gradio
7
+ sdk_version: "6.5.1"
8
  app_file: app.py
9
  pinned: false
10
+ short_description: Developmental stages, critical periods, capability gating
11
  ---
12
 
13
+ Interactive dashboard for Operon's developmental staging — organisms progress
14
+ through maturity stages with capability gating and closing critical periods.
app.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Operon Developmental Staging Dashboard."""
2
+
3
+ from __future__ import annotations
4
+ from enum import Enum
5
+
6
+ import gradio as gr
7
+
8
+
9
+ class Stage(Enum):
10
+ EMBRYONIC = "embryonic"
11
+ JUVENILE = "juvenile"
12
+ ADOLESCENT = "adolescent"
13
+ MATURE = "mature"
14
+
15
+ STAGES = [Stage.EMBRYONIC, Stage.JUVENILE, Stage.ADOLESCENT, Stage.MATURE]
16
+ PLASTICITY = {Stage.EMBRYONIC: 1.0, Stage.JUVENILE: 0.75, Stage.ADOLESCENT: 0.5, Stage.MATURE: 0.25}
17
+ COLORS = {Stage.EMBRYONIC: "#4ade80", Stage.JUVENILE: "#60a5fa", Stage.ADOLESCENT: "#f59e0b", Stage.MATURE: "#a78bfa"}
18
+
19
+ CRITICAL_PERIODS = [
20
+ ("rapid_learning", Stage.EMBRYONIC, Stage.JUVENILE, "Fast template adoption from peers"),
21
+ ("tool_exploration", Stage.JUVENILE, Stage.ADOLESCENT, "Try new tools freely"),
22
+ ("social_bonding", Stage.EMBRYONIC, Stage.ADOLESCENT, "Form trust with peers"),
23
+ ]
24
+
25
+ TOOLS = [
26
+ ("basic_tool", Stage.EMBRYONIC, "Simple text processing"),
27
+ ("analyzer", Stage.JUVENILE, "Data analysis toolkit"),
28
+ ("planner", Stage.ADOLESCENT, "Strategic planning"),
29
+ ("orchestrator", Stage.MATURE, "Full multi-agent orchestration"),
30
+ ]
31
+
32
+
33
+ def _get_stage(consumed_frac, juv_t, adol_t, mat_t):
34
+ if consumed_frac >= mat_t / 100: return Stage.MATURE
35
+ if consumed_frac >= adol_t / 100: return Stage.ADOLESCENT
36
+ if consumed_frac >= juv_t / 100: return Stage.JUVENILE
37
+ return Stage.EMBRYONIC
38
+
39
+
40
+ def _run_lifecycle(max_ops, juv_t, adol_t, mat_t):
41
+ rows = ""
42
+ last = None
43
+ transitions = []
44
+ for tick in range(1, int(max_ops) + 1):
45
+ consumed = tick / max_ops
46
+ stage = _get_stage(consumed, juv_t, adol_t, mat_t)
47
+ if stage != last:
48
+ if last is not None:
49
+ transitions.append((tick, last, stage))
50
+ last = stage
51
+
52
+ for tick, old, new in transitions:
53
+ color = COLORS[new]
54
+ rows += f"""<tr>
55
+ <td style="padding:8px">Tick {tick}</td>
56
+ <td style="padding:8px;color:{COLORS[old]}">{old.value}</td>
57
+ <td style="padding:8px">&rarr;</td>
58
+ <td style="padding:8px;color:{color};font-weight:600">{new.value}</td>
59
+ <td style="padding:8px">{PLASTICITY[new]:.2f}</td>
60
+ </tr>"""
61
+
62
+ table = f"""<table style="width:100%;border-collapse:collapse;font-size:14px">
63
+ <thead><tr style="border-bottom:2px solid #333">
64
+ <th style="text-align:left;padding:8px">Tick</th>
65
+ <th style="text-align:left;padding:8px">From</th>
66
+ <th></th>
67
+ <th style="text-align:left;padding:8px">To</th>
68
+ <th style="text-align:left;padding:8px">Plasticity</th>
69
+ </tr></thead>
70
+ <tbody>{rows}</tbody>
71
+ </table>"""
72
+
73
+ # Critical periods
74
+ final_stage = _get_stage(1.0, juv_t, adol_t, mat_t)
75
+ cp_rows = ""
76
+ stage_order = {s: i for i, s in enumerate(STAGES)}
77
+ for name, opens, closes, desc in CRITICAL_PERIODS:
78
+ is_closed = stage_order[final_stage] >= stage_order[closes]
79
+ status = "CLOSED" if is_closed else "OPEN"
80
+ color = "#a44" if is_closed else "#4a4"
81
+ cp_rows += f"""<tr>
82
+ <td style="padding:8px">{name}</td>
83
+ <td style="padding:8px">{opens.value} → {closes.value}</td>
84
+ <td style="padding:8px;color:{color};font-weight:600">{status}</td>
85
+ <td style="padding:8px;font-size:12px;color:#888">{desc}</td>
86
+ </tr>"""
87
+
88
+ cp_table = f"""<h3 style="margin-top:24px">Critical Periods at MATURE</h3>
89
+ <table style="width:100%;border-collapse:collapse;font-size:14px">
90
+ <thead><tr style="border-bottom:2px solid #333">
91
+ <th style="text-align:left;padding:8px">Period</th>
92
+ <th style="text-align:left;padding:8px">Window</th>
93
+ <th style="text-align:left;padding:8px">Status</th>
94
+ <th style="text-align:left;padding:8px">Description</th>
95
+ </tr></thead>
96
+ <tbody>{cp_rows}</tbody>
97
+ </table>"""
98
+
99
+ # Tools
100
+ tool_rows = ""
101
+ for name, min_stage, desc in TOOLS:
102
+ can_acquire = stage_order[final_stage] >= stage_order[min_stage]
103
+ color = "#4a4" if can_acquire else "#a44"
104
+ tool_rows += f"""<tr>
105
+ <td style="padding:8px">{name}</td>
106
+ <td style="padding:8px">{min_stage.value}</td>
107
+ <td style="padding:8px;color:{color};font-weight:600">{'AVAILABLE' if can_acquire else 'LOCKED'}</td>
108
+ <td style="padding:8px;font-size:12px;color:#888">{desc}</td>
109
+ </tr>"""
110
+
111
+ tool_table = f"""<h3 style="margin-top:24px">Capability Gating at MATURE</h3>
112
+ <table style="width:100%;border-collapse:collapse;font-size:14px">
113
+ <thead><tr style="border-bottom:2px solid #333">
114
+ <th style="text-align:left;padding:8px">Tool</th>
115
+ <th style="text-align:left;padding:8px">Min Stage</th>
116
+ <th style="text-align:left;padding:8px">Status</th>
117
+ <th style="text-align:left;padding:8px">Description</th>
118
+ </tr></thead>
119
+ <tbody>{tool_rows}</tbody>
120
+ </table>"""
121
+
122
+ return table + cp_table + tool_table
123
+
124
+
125
+ def build_app():
126
+ with gr.Blocks(title="Operon Developmental Staging", theme=gr.themes.Base()) as demo:
127
+ gr.Markdown("# Operon Developmental Staging\nLifecycle progression, critical periods, and capability gating.")
128
+
129
+ max_ops = gr.Slider(10, 500, value=100, step=10, label="Max Operations")
130
+ juv = gr.Slider(1, 50, value=10, step=1, label="Juvenile Threshold (%)")
131
+ adol = gr.Slider(10, 80, value=35, step=5, label="Adolescent Threshold (%)")
132
+ mat = gr.Slider(30, 95, value=70, step=5, label="Mature Threshold (%)")
133
+ btn = gr.Button("Run Lifecycle")
134
+ out = gr.HTML()
135
+ btn.click(_run_lifecycle, inputs=[max_ops, juv, adol, mat], outputs=[out])
136
+
137
+ return demo
138
+
139
+
140
+ if __name__ == "__main__":
141
+ app = build_app()
142
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio>=4.0