Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# ============================================================
|
| 2 |
-
#
|
| 3 |
# Author: Liam Grinstead | RFT Systems | All Rights Reserved
|
| 4 |
# ============================================================
|
| 5 |
|
|
@@ -9,7 +9,7 @@ import numpy as np
|
|
| 9 |
import gradio as gr
|
| 10 |
|
| 11 |
# ------------------ About / Legal ---------------------------
|
| 12 |
-
RFT_VERSION = "v4.0-
|
| 13 |
RFT_DOI = "https://doi.org/10.5281/zenodo.17466722"
|
| 14 |
LEGAL_NOTICE = (
|
| 15 |
"All Rights Reserved — RFT-IPURL v1.0 (UK / Berne). "
|
|
@@ -62,7 +62,7 @@ def run(profile, dist, sigma, seed, samples):
|
|
| 62 |
key=lambda s: sum(1 for r in results if r["status"] == s),
|
| 63 |
)
|
| 64 |
|
| 65 |
-
|
| 66 |
"profile": profile,
|
| 67 |
"noise_scale": sigma,
|
| 68 |
"distribution": dist,
|
|
@@ -72,37 +72,48 @@ def run(profile, dist, sigma, seed, samples):
|
|
| 72 |
"timestamp_utc": datetime.utcnow().isoformat() + "Z",
|
| 73 |
"rft_notice": LEGAL_NOTICE,
|
| 74 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
# ------------------ Gradio Interface ------------------------
|
| 77 |
-
with gr.Blocks(title="
|
| 78 |
gr.Markdown(
|
| 79 |
-
f"
|
| 80 |
-
f"
|
|
|
|
| 81 |
f"{LEGAL_NOTICE}"
|
| 82 |
)
|
| 83 |
|
| 84 |
-
# ---- New Instruction Panel ----
|
| 85 |
gr.Markdown(
|
| 86 |
"""
|
| 87 |
-
🧩
|
| 88 |
1️⃣ Select a **System Profile** (AI / Neural, SpaceX / Aerospace, Energy / RHES, Extreme Perturbation).
|
| 89 |
2️⃣ Choose a **Noise Distribution** (gauss or uniform).
|
| 90 |
-
3️⃣ Adjust **Noise Scale (σ)** to simulate
|
| 91 |
-
4️⃣ Press **Run Simulation** — results
|
| 92 |
-
|
| 93 |
-
|
|
|
|
| 94 |
- `Nominal` → Stable harmonic equilibrium
|
| 95 |
- `Perturbed` → Transitional / adaptive state
|
| 96 |
- `Critical` → Instability threshold reached
|
| 97 |
-
|
| 98 |
-
|
| 99 |
"""
|
| 100 |
)
|
| 101 |
|
| 102 |
with gr.Row():
|
| 103 |
-
profile = gr.Dropdown(
|
| 104 |
-
list(PROFILES.keys()), label="System Profile", value="AI / Neural"
|
| 105 |
-
)
|
| 106 |
dist = gr.Radio(["gauss", "uniform"], label="Noise Distribution", value="gauss")
|
| 107 |
|
| 108 |
with gr.Row():
|
|
@@ -112,8 +123,12 @@ with gr.Blocks(title="RFT-Ω Total-Proof Kernel") as demo:
|
|
| 112 |
|
| 113 |
run_btn = gr.Button("Run Simulation")
|
| 114 |
output = gr.JSON(label="Simulation Results")
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
-
run_btn.click(run, inputs=[profile, dist, sigma, seed, samples], outputs=[output])
|
|
|
|
| 117 |
|
| 118 |
# ------------------ Launch -------------------------------
|
| 119 |
if __name__ == "__main__":
|
|
|
|
| 1 |
# ============================================================
|
| 2 |
+
# Rendered Frame Theory — Stabilising System Verification Panel
|
| 3 |
# Author: Liam Grinstead | RFT Systems | All Rights Reserved
|
| 4 |
# ============================================================
|
| 5 |
|
|
|
|
| 9 |
import gradio as gr
|
| 10 |
|
| 11 |
# ------------------ About / Legal ---------------------------
|
| 12 |
+
RFT_VERSION = "v4.0-verification-panel"
|
| 13 |
RFT_DOI = "https://doi.org/10.5281/zenodo.17466722"
|
| 14 |
LEGAL_NOTICE = (
|
| 15 |
"All Rights Reserved — RFT-IPURL v1.0 (UK / Berne). "
|
|
|
|
| 62 |
key=lambda s: sum(1 for r in results if r["status"] == s),
|
| 63 |
)
|
| 64 |
|
| 65 |
+
summary = {
|
| 66 |
"profile": profile,
|
| 67 |
"noise_scale": sigma,
|
| 68 |
"distribution": dist,
|
|
|
|
| 72 |
"timestamp_utc": datetime.utcnow().isoformat() + "Z",
|
| 73 |
"rft_notice": LEGAL_NOTICE,
|
| 74 |
}
|
| 75 |
+
return summary, json.dumps(summary, indent=2)
|
| 76 |
+
|
| 77 |
+
# ------------------ File Saver -------------------------------
|
| 78 |
+
def save_run_log(run_json_str):
|
| 79 |
+
try:
|
| 80 |
+
data = json.loads(run_json_str)
|
| 81 |
+
filename = f"RFT_Omega_Run_{datetime.utcnow().strftime('%Y-%m-%dT%H-%M-%SZ')}.json"
|
| 82 |
+
with open(filename, "w") as f:
|
| 83 |
+
json.dump(data, f, indent=2)
|
| 84 |
+
return filename
|
| 85 |
+
except Exception as e:
|
| 86 |
+
return None
|
| 87 |
|
| 88 |
# ------------------ Gradio Interface ------------------------
|
| 89 |
+
with gr.Blocks(title="Rendered Frame Theory — Stabilising System Verification Panel") as demo:
|
| 90 |
gr.Markdown(
|
| 91 |
+
f"## 🧠 Rendered Frame Theory — Stabilising System Verification Panel \n"
|
| 92 |
+
f"**Version:** {RFT_VERSION} \n"
|
| 93 |
+
f"**DOI:** [{RFT_DOI}]({RFT_DOI}) \n"
|
| 94 |
f"{LEGAL_NOTICE}"
|
| 95 |
)
|
| 96 |
|
|
|
|
| 97 |
gr.Markdown(
|
| 98 |
"""
|
| 99 |
+
### 🧩 How to Use
|
| 100 |
1️⃣ Select a **System Profile** (AI / Neural, SpaceX / Aerospace, Energy / RHES, Extreme Perturbation).
|
| 101 |
2️⃣ Choose a **Noise Distribution** (gauss or uniform).
|
| 102 |
+
3️⃣ Adjust **Noise Scale (σ)** to simulate environmental perturbations.
|
| 103 |
+
4️⃣ Press **Run Simulation** — results will show mean QΩ (stability) and ζ_sync (coherence) across samples.
|
| 104 |
+
5️⃣ Use **Save Run Log** to download your test record as a JSON file with timestamp.
|
| 105 |
+
|
| 106 |
+
**Interpretation:**
|
| 107 |
- `Nominal` → Stable harmonic equilibrium
|
| 108 |
- `Perturbed` → Transitional / adaptive state
|
| 109 |
- `Critical` → Instability threshold reached
|
| 110 |
+
|
| 111 |
+
Each output is time-stamped, reproducible, and protected under RFT-IPURL v1.0.
|
| 112 |
"""
|
| 113 |
)
|
| 114 |
|
| 115 |
with gr.Row():
|
| 116 |
+
profile = gr.Dropdown(list(PROFILES.keys()), label="System Profile", value="AI / Neural")
|
|
|
|
|
|
|
| 117 |
dist = gr.Radio(["gauss", "uniform"], label="Noise Distribution", value="gauss")
|
| 118 |
|
| 119 |
with gr.Row():
|
|
|
|
| 123 |
|
| 124 |
run_btn = gr.Button("Run Simulation")
|
| 125 |
output = gr.JSON(label="Simulation Results")
|
| 126 |
+
hidden_json = gr.Textbox(visible=False)
|
| 127 |
+
save_btn = gr.Button("💾 Save Run Log")
|
| 128 |
+
download_file = gr.File(label="Download Saved Log")
|
| 129 |
|
| 130 |
+
run_btn.click(run, inputs=[profile, dist, sigma, seed, samples], outputs=[output, hidden_json])
|
| 131 |
+
save_btn.click(save_run_log, inputs=[hidden_json], outputs=[download_file])
|
| 132 |
|
| 133 |
# ------------------ Launch -------------------------------
|
| 134 |
if __name__ == "__main__":
|