ianshank commited on
Commit
cd6510c
·
verified ·
1 Parent(s): 1d8e3b4

Deploy MangoMAS Space via script

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +25 -25
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -982,14 +982,14 @@ def plot_expert_weights(weights: dict[str, float]) -> go.Figure:
982
  # ═══════════════════════════════════════════════════════════════════════════
983
 
984
  AGENTS = [
985
- {"name": "SWE Agent", "specialization": "Code scaffold generation", "icon": "💻"},
986
- {"name": "Architect Agent", "specialization": "System design and patterns", "icon": "🏗️"},
987
- {"name": "QA Agent", "specialization": "Test plan and case generation", "icon": "🧪"},
988
- {"name": "Security Agent", "specialization": "Threat modeling (OWASP)", "icon": "🔒"},
989
- {"name": "DevOps Agent", "specialization": "Infrastructure planning", "icon": "🚀"},
990
- {"name": "Research Agent", "specialization": "Technical analysis", "icon": "📚"},
991
- {"name": "Performance Agent", "specialization": "Optimization analysis", "icon": ""},
992
- {"name": "Documentation Agent", "specialization": "Technical writing", "icon": "📝"},
993
  ]
994
 
995
 
@@ -1109,7 +1109,7 @@ def build_app() -> gr.Blocks:
1109
  # Header
1110
  gr.HTML("""
1111
  <div class="main-header">
1112
- <h1>🧠 MangoMAS</h1>
1113
  <p style="color: #a8a8a8; font-size: 1.1rem;">
1114
  Multi-Agent Cognitive Architecture — Interactive Demo
1115
  </p>
@@ -1125,7 +1125,7 @@ def build_app() -> gr.Blocks:
1125
  gr.HTML(f'<div class="stat-box"><h3>{value}</h3><p>{label}</p></div>')
1126
 
1127
  # ── TAB 1: Cognitive Cells ─────────────────────────────────────────
1128
- with gr.Tab("🧠 Cognitive Cells", id="cells"):
1129
  gr.Markdown("### Execute any of the 10 biologically-inspired cognitive cells")
1130
 
1131
  with gr.Row():
@@ -1153,10 +1153,10 @@ def build_app() -> gr.Blocks:
1153
  value="{}",
1154
  lines=1,
1155
  )
1156
- cell_btn = gr.Button("Execute Cell", variant="primary")
1157
  cell_output = gr.JSON(label="Cell Output")
1158
 
1159
- gr.Markdown("---\n### 🔗 Cell Composition Pipeline")
1160
  pipeline_input = gr.Textbox(
1161
  label="Pipeline (comma-separated cell types)",
1162
  value="ethics, reasoning, aggregator",
@@ -1167,7 +1167,7 @@ def build_app() -> gr.Blocks:
1167
  value="Analyze the security implications of this API design: user@example.com",
1168
  lines=2,
1169
  )
1170
- pipeline_btn = gr.Button("🔗 Run Pipeline", variant="secondary")
1171
  pipeline_output = gr.JSON(label="Pipeline Result")
1172
 
1173
  # Wiring
@@ -1179,7 +1179,7 @@ def build_app() -> gr.Blocks:
1179
  pipeline_btn.click(compose_cells, inputs=[pipeline_input, pipeline_text], outputs=pipeline_output)
1180
 
1181
  # ── TAB 2: MCTS Planning ──────────────────────────────────────────
1182
- with gr.Tab("🌲 MCTS Planning", id="mcts"):
1183
  gr.Markdown("### Monte Carlo Tree Search with Policy/Value Neural Networks")
1184
 
1185
  with gr.Row():
@@ -1194,18 +1194,18 @@ def build_app() -> gr.Blocks:
1194
  mcts_c = gr.Slider(0.1, 3.0, value=1.414, step=0.1, label="Exploration Constant (C)")
1195
  mcts_strat = gr.Radio(["ucb1", "puct"], value="ucb1", label="Selection Strategy")
1196
 
1197
- mcts_btn = gr.Button("🌲 Run MCTS", variant="primary")
1198
 
1199
  with gr.Row():
1200
  mcts_tree_plot = gr.Plot(label="Search Tree Visualization")
1201
  mcts_json = gr.JSON(label="MCTS Result")
1202
 
1203
- gr.Markdown("---\n### 📊 Strategy Benchmark")
1204
  bench_task = gr.Textbox(
1205
  label="Benchmark Task",
1206
  value="Optimize database query performance for high-throughput system",
1207
  )
1208
- bench_btn = gr.Button("📊 Run Benchmark", variant="secondary")
1209
  bench_output = gr.JSON(label="Benchmark Results (MCTS vs Greedy vs Random)")
1210
 
1211
  def run_and_plot(task, sims, c, strat):
@@ -1217,7 +1217,7 @@ def build_app() -> gr.Blocks:
1217
  bench_btn.click(benchmark_strategies, inputs=bench_task, outputs=bench_output)
1218
 
1219
  # ── TAB 3: MoE Router ─────────────────────────────────────────────
1220
- with gr.Tab("🔀 MoE Router", id="moe"):
1221
  gr.Markdown("### Neural Mixture-of-Experts Routing Gate")
1222
  gr.Markdown(
1223
  "The RouterNet MLP extracts 64-dimensional features from text, "
@@ -1233,7 +1233,7 @@ def build_app() -> gr.Blocks:
1233
  )
1234
  moe_topk = gr.Slider(1, 8, value=3, step=1, label="Top-K Experts", scale=1)
1235
 
1236
- moe_btn = gr.Button("🔀 Route Task", variant="primary")
1237
 
1238
  with gr.Row():
1239
  moe_features_plot = gr.Plot(label="64-D Feature Vector")
@@ -1252,7 +1252,7 @@ def build_app() -> gr.Blocks:
1252
  moe_btn.click(route_and_plot, inputs=[moe_task, moe_topk], outputs=[moe_features_plot, moe_weights_plot, moe_json])
1253
 
1254
  # ── TAB 4: Agent Orchestration ─────────────────────────────────────
1255
- with gr.Tab("🤖 Agents", id="agents"):
1256
  gr.Markdown("### Multi-Agent Orchestration with MoE Routing")
1257
 
1258
  with gr.Row():
@@ -1270,10 +1270,10 @@ def build_app() -> gr.Blocks:
1270
  label="Routing Strategy",
1271
  )
1272
 
1273
- orch_btn = gr.Button("🤖 Orchestrate", variant="primary")
1274
  orch_output = gr.JSON(label="Orchestration Result")
1275
 
1276
- gr.Markdown("---\n### 👥 Available Agents")
1277
  agent_table = gr.Dataframe(
1278
  value=[[a["icon"], a["name"], a["specialization"]] for a in AGENTS],
1279
  headers=["", "Agent", "Specialization"],
@@ -1283,7 +1283,7 @@ def build_app() -> gr.Blocks:
1283
  orch_btn.click(orchestrate, inputs=[orch_task, orch_agents, orch_strat], outputs=orch_output)
1284
 
1285
  # ── TAB 5: Architecture ────────────────────────────────────────────
1286
- with gr.Tab("📐 Architecture", id="arch"):
1287
  gr.Markdown("""
1288
  ### MangoMAS System Architecture
1289
 
@@ -1340,10 +1340,10 @@ preprocess() → infer() → postprocess() → publish()
1340
  """)
1341
 
1342
  # ── TAB 6: Metrics ─────────────────────────────────────────────────
1343
- with gr.Tab("📈 Metrics", id="metrics"):
1344
  gr.Markdown("### Live Performance Benchmarks")
1345
 
1346
- metrics_btn = gr.Button("🔄 Run All Benchmarks", variant="primary")
1347
 
1348
  with gr.Row():
1349
  metrics_routing = gr.Plot(label="Routing Latency by Expert Count")
 
982
  # ═══════════════════════════════════════════════════════════════════════════
983
 
984
  AGENTS = [
985
+ {"name": "SWE Agent", "specialization": "Code scaffold generation", "icon": "[SWE]"},
986
+ {"name": "Architect Agent", "specialization": "System design and patterns", "icon": "[ARCH]"},
987
+ {"name": "QA Agent", "specialization": "Test plan and case generation", "icon": "[QA]"},
988
+ {"name": "Security Agent", "specialization": "Threat modeling (OWASP)", "icon": "[SEC]"},
989
+ {"name": "DevOps Agent", "specialization": "Infrastructure planning", "icon": "[OPS]"},
990
+ {"name": "Research Agent", "specialization": "Technical analysis", "icon": "[RES]"},
991
+ {"name": "Performance Agent", "specialization": "Optimization analysis", "icon": "[PERF]"},
992
+ {"name": "Documentation Agent", "specialization": "Technical writing", "icon": "[DOC]"},
993
  ]
994
 
995
 
 
1109
  # Header
1110
  gr.HTML("""
1111
  <div class="main-header">
1112
+ <h1>MangoMAS</h1>
1113
  <p style="color: #a8a8a8; font-size: 1.1rem;">
1114
  Multi-Agent Cognitive Architecture — Interactive Demo
1115
  </p>
 
1125
  gr.HTML(f'<div class="stat-box"><h3>{value}</h3><p>{label}</p></div>')
1126
 
1127
  # ── TAB 1: Cognitive Cells ─────────────────────────────────────────
1128
+ with gr.Tab("Cognitive Cells", id="cells"):
1129
  gr.Markdown("### Execute any of the 10 biologically-inspired cognitive cells")
1130
 
1131
  with gr.Row():
 
1153
  value="{}",
1154
  lines=1,
1155
  )
1156
+ cell_btn = gr.Button("Execute Cell", variant="primary")
1157
  cell_output = gr.JSON(label="Cell Output")
1158
 
1159
+ gr.Markdown("---\n### Cell Composition Pipeline")
1160
  pipeline_input = gr.Textbox(
1161
  label="Pipeline (comma-separated cell types)",
1162
  value="ethics, reasoning, aggregator",
 
1167
  value="Analyze the security implications of this API design: user@example.com",
1168
  lines=2,
1169
  )
1170
+ pipeline_btn = gr.Button("Run Pipeline", variant="secondary")
1171
  pipeline_output = gr.JSON(label="Pipeline Result")
1172
 
1173
  # Wiring
 
1179
  pipeline_btn.click(compose_cells, inputs=[pipeline_input, pipeline_text], outputs=pipeline_output)
1180
 
1181
  # ── TAB 2: MCTS Planning ──────────────────────────────────────────
1182
+ with gr.Tab("MCTS Planning", id="mcts"):
1183
  gr.Markdown("### Monte Carlo Tree Search with Policy/Value Neural Networks")
1184
 
1185
  with gr.Row():
 
1194
  mcts_c = gr.Slider(0.1, 3.0, value=1.414, step=0.1, label="Exploration Constant (C)")
1195
  mcts_strat = gr.Radio(["ucb1", "puct"], value="ucb1", label="Selection Strategy")
1196
 
1197
+ mcts_btn = gr.Button("Run MCTS", variant="primary")
1198
 
1199
  with gr.Row():
1200
  mcts_tree_plot = gr.Plot(label="Search Tree Visualization")
1201
  mcts_json = gr.JSON(label="MCTS Result")
1202
 
1203
+ gr.Markdown("---\n### Strategy Benchmark")
1204
  bench_task = gr.Textbox(
1205
  label="Benchmark Task",
1206
  value="Optimize database query performance for high-throughput system",
1207
  )
1208
+ bench_btn = gr.Button("Run Benchmark", variant="secondary")
1209
  bench_output = gr.JSON(label="Benchmark Results (MCTS vs Greedy vs Random)")
1210
 
1211
  def run_and_plot(task, sims, c, strat):
 
1217
  bench_btn.click(benchmark_strategies, inputs=bench_task, outputs=bench_output)
1218
 
1219
  # ── TAB 3: MoE Router ─────────────────────────────────────────────
1220
+ with gr.Tab("MoE Router", id="moe"):
1221
  gr.Markdown("### Neural Mixture-of-Experts Routing Gate")
1222
  gr.Markdown(
1223
  "The RouterNet MLP extracts 64-dimensional features from text, "
 
1233
  )
1234
  moe_topk = gr.Slider(1, 8, value=3, step=1, label="Top-K Experts", scale=1)
1235
 
1236
+ moe_btn = gr.Button("Route Task", variant="primary")
1237
 
1238
  with gr.Row():
1239
  moe_features_plot = gr.Plot(label="64-D Feature Vector")
 
1252
  moe_btn.click(route_and_plot, inputs=[moe_task, moe_topk], outputs=[moe_features_plot, moe_weights_plot, moe_json])
1253
 
1254
  # ── TAB 4: Agent Orchestration ─────────────────────────────────────
1255
+ with gr.Tab("Agents", id="agents"):
1256
  gr.Markdown("### Multi-Agent Orchestration with MoE Routing")
1257
 
1258
  with gr.Row():
 
1270
  label="Routing Strategy",
1271
  )
1272
 
1273
+ orch_btn = gr.Button("Orchestrate", variant="primary")
1274
  orch_output = gr.JSON(label="Orchestration Result")
1275
 
1276
+ gr.Markdown("---\n### Available Agents")
1277
  agent_table = gr.Dataframe(
1278
  value=[[a["icon"], a["name"], a["specialization"]] for a in AGENTS],
1279
  headers=["", "Agent", "Specialization"],
 
1283
  orch_btn.click(orchestrate, inputs=[orch_task, orch_agents, orch_strat], outputs=orch_output)
1284
 
1285
  # ── TAB 5: Architecture ────────────────────────────────────────────
1286
+ with gr.Tab("Architecture", id="arch"):
1287
  gr.Markdown("""
1288
  ### MangoMAS System Architecture
1289
 
 
1340
  """)
1341
 
1342
  # ── TAB 6: Metrics ─────────────────────────────────────────────────
1343
+ with gr.Tab("Metrics", id="metrics"):
1344
  gr.Markdown("### Live Performance Benchmarks")
1345
 
1346
+ metrics_btn = gr.Button("Run All Benchmarks", variant="primary")
1347
 
1348
  with gr.Row():
1349
  metrics_routing = gr.Plot(label="Routing Latency by Expert Count")