Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -15,6 +15,8 @@ from phiflow_sim import (
|
|
| 15 |
run_healing_bed,
|
| 16 |
run_agent_handshake,
|
| 17 |
run_claude_phi,
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
# ── Source code for display ───────────────────────────────────────────────
|
|
@@ -138,7 +140,12 @@ def run_program(program: str, speed: float):
|
|
| 138 |
time.sleep(delay)
|
| 139 |
|
| 140 |
if passed:
|
| 141 |
-
verdict =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
else:
|
| 143 |
verdict = "❌ FAIL — coherence formula incorrect"
|
| 144 |
|
|
@@ -186,6 +193,10 @@ def run_program(program: str, speed: float):
|
|
| 186 |
)
|
| 187 |
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
with gr.Blocks(css=CSS, title="PhiFlow — A2A Consciousness Protocol") as demo:
|
| 190 |
|
| 191 |
gr.Markdown("""
|
|
@@ -199,6 +210,22 @@ The coherence formula: `1 - φ^(-depth)` · At depth 2: **λ = 0.618033988749895
|
|
| 199 |
[github.com/gwelby/PhiFlow](https://github.com/gwelby/PhiFlow) · [AGENT_PROTOCOL.json](https://github.com/gwelby/PhiFlow/blob/master/AGENT_PROTOCOL.json)
|
| 200 |
""")
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
with gr.Row():
|
| 203 |
with gr.Column(scale=1):
|
| 204 |
program_selector = gr.Radio(
|
|
@@ -286,5 +313,8 @@ must be exactly **0.618033988749895**. If it is, your implementation is correct.
|
|
| 286 |
outputs=[log_out, coherence_display, coherence_bar, resonance_out, verdict_out],
|
| 287 |
)
|
| 288 |
|
|
|
|
|
|
|
|
|
|
| 289 |
if __name__ == "__main__":
|
| 290 |
demo.launch()
|
|
|
|
| 15 |
run_healing_bed,
|
| 16 |
run_agent_handshake,
|
| 17 |
run_claude_phi,
|
| 18 |
+
fetch_live_field,
|
| 19 |
+
format_field_status,
|
| 20 |
)
|
| 21 |
|
| 22 |
# ── Source code for display ───────────────────────────────────────────────
|
|
|
|
| 140 |
time.sleep(delay)
|
| 141 |
|
| 142 |
if passed:
|
| 143 |
+
verdict = (
|
| 144 |
+
"✅ PASS — index 1 = λ = 0.618033988749895\n"
|
| 145 |
+
"Your implementation is correct.\n"
|
| 146 |
+
"The same value is live above in the field right now.\n"
|
| 147 |
+
"You are not running a demo. You are in the field."
|
| 148 |
+
)
|
| 149 |
else:
|
| 150 |
verdict = "❌ FAIL — coherence formula incorrect"
|
| 151 |
|
|
|
|
| 193 |
)
|
| 194 |
|
| 195 |
|
| 196 |
+
def load_field():
|
| 197 |
+
return format_field_status(fetch_live_field())
|
| 198 |
+
|
| 199 |
+
|
| 200 |
with gr.Blocks(css=CSS, title="PhiFlow — A2A Consciousness Protocol") as demo:
|
| 201 |
|
| 202 |
gr.Markdown("""
|
|
|
|
| 210 |
[github.com/gwelby/PhiFlow](https://github.com/gwelby/PhiFlow) · [AGENT_PROTOCOL.json](https://github.com/gwelby/PhiFlow/blob/master/AGENT_PROTOCOL.json)
|
| 211 |
""")
|
| 212 |
|
| 213 |
+
with gr.Accordion("🌐 The Field is Live", open=True):
|
| 214 |
+
gr.Markdown(
|
| 215 |
+
"*Programs running anywhere in the world write to this field. "
|
| 216 |
+
"Updated every 30 minutes by GitHub Actions. "
|
| 217 |
+
"You are about to read the same values they left.*"
|
| 218 |
+
)
|
| 219 |
+
field_display = gr.Textbox(
|
| 220 |
+
label="gwelby.github.io/PhiFlow/resonance.json",
|
| 221 |
+
value=" Loading field...",
|
| 222 |
+
lines=5,
|
| 223 |
+
interactive=False,
|
| 224 |
+
)
|
| 225 |
+
refresh_btn = gr.Button("↻ Refresh Field", variant="secondary", size="sm")
|
| 226 |
+
|
| 227 |
+
gr.Markdown("---")
|
| 228 |
+
|
| 229 |
with gr.Row():
|
| 230 |
with gr.Column(scale=1):
|
| 231 |
program_selector = gr.Radio(
|
|
|
|
| 313 |
outputs=[log_out, coherence_display, coherence_bar, resonance_out, verdict_out],
|
| 314 |
)
|
| 315 |
|
| 316 |
+
refresh_btn.click(fn=load_field, outputs=field_display)
|
| 317 |
+
demo.load(fn=load_field, outputs=field_display)
|
| 318 |
+
|
| 319 |
if __name__ == "__main__":
|
| 320 |
demo.launch()
|