RFTSystems commited on
Commit
5f0f488
·
verified ·
1 Parent(s): d4084dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -20
app.py CHANGED
@@ -188,26 +188,27 @@ with gr.Tab("Overview"):
188
  gr.Image(value="assets/banner.png", label="Progression (v1→v10)")
189
  gr.Image(value="assets/glyphs.png", label="Glyphs: Ξ (foresight), ◊̃₅ (shadow), ℝ (anchor)")
190
 
191
- # v1–v3 Single agent
192
- with gr.Tab("Single agent (v1–v3)"):
193
- obstacle = gr.Checkbox(label="Enable moving obstacle (v3)", value=True)
194
- steps = gr.Slider(10, 200, value=80, step=10, label="Steps")
195
- run = gr.Button("Run")
196
- grid_img = gr.Image(type="pil", label="3×3 grid (gold = agent position)")
197
- pr_out = gr.Number(label="Predictive rate (%)")
198
- err_out = gr.Number(label="Last error")
199
-
200
- def run_single(ob_on, T):
201
- agent = MinimalSelf()
202
- obs = MovingObstacle() if ob_on else None
203
- for _ in range(int(T)):
204
- res = agent.step(obstacle=obs)
205
- mask = np.zeros((3, 3), dtype=bool)
206
- i, j = int(agent.pos[1]), int(agent.pos[0])
207
- mask[i, j] = True
208
- img = draw_grid(3, mask, title="Single Agent", subtitle="Gold cell shows current position")
209
- return img, res["predictive_rate"], res["error"]
210
-
 
211
  run.click(run_single, inputs=[obstacle, steps], outputs=[grid_img, pr_out, err_out])
212
 
213
  # v4 S-Equation
 
188
  gr.Image(value="assets/banner.png", label="Progression (v1→v10)")
189
  gr.Image(value="assets/glyphs.png", label="Glyphs: Ξ (foresight), ◊̃₅ (shadow), ℝ (anchor)")
190
 
191
+ with gr.Blocks(title="Minimal Selfhood Threshold") as demo:
192
+ with gr.Tab("Single agent (v1–v3)"):
193
+ obstacle = gr.Checkbox(label="Enable moving obstacle (v3)", value=True)
194
+ steps = gr.Slider(10, 200, value=80, step=10, label="Steps")
195
+ run = gr.Button("Run")
196
+ grid_img = gr.Image(type="pil", label="3×3 grid (gold = agent position)")
197
+ pr_out = gr.Number(label="Predictive rate (%)")
198
+ err_out = gr.Number(label="Last error")
199
+
200
+ def run_single(ob_on, T):
201
+ agent = MinimalSelf()
202
+ obs = MovingObstacle() if ob_on else None
203
+ for _ in range(int(T)):
204
+ res = agent.step(obstacle=obs)
205
+ mask = np.zeros((3, 3), dtype=bool)
206
+ i, j = int(agent.pos[1]), int(agent.pos[0])
207
+ mask[i, j] = True
208
+ img = draw_grid(3, mask, title="Single Agent", subtitle="Gold cell shows current position")
209
+ return img, res["predictive_rate"], res["error"]
210
+
211
+ # 👇 This must stay inside the Blocks context
212
  run.click(run_single, inputs=[obstacle, steps], outputs=[grid_img, pr_out, err_out])
213
 
214
  # v4 S-Equation