RFTSystems commited on
Commit
09ef6ea
·
verified ·
1 Parent(s): 1c2a285

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -30
app.py CHANGED
@@ -1,9 +1,9 @@
1
  # ============================================================
2
- # RFT-Ω FRAMEWORK — TOTAL-PROOF API (Gradio Stand-Alone Build)
3
  # Author: Liam Grinstead | RFT Systems | All Rights Reserved
4
  # ============================================================
5
 
6
- import os, json, time, hashlib, zipfile, random
7
  from datetime import datetime
8
  import numpy as np
9
  import gradio as gr
@@ -16,6 +16,7 @@ LEGAL_NOTICE = (
16
  "Research validation use only. No reverse-engineering without written consent."
17
  )
18
 
 
19
  PROFILES = {
20
  "AI / Neural": {"base": (0.86, 0.80), "w": (0.65, 0.35)},
21
  "SpaceX / Aerospace": {"base": (0.84, 0.79), "w": (0.60, 0.40)},
@@ -23,7 +24,8 @@ PROFILES = {
23
  "Extreme Perturbation": {"base": (0.82, 0.77), "w": (0.50, 0.50)},
24
  }
25
 
26
- def _rng(seed:int): return np.random.RandomState(seed)
 
27
 
28
  def simulate_step(rng, profile, sigma, dist):
29
  base_q, base_z = PROFILES[profile]["base"]
@@ -36,56 +38,53 @@ def simulate_step(rng, profile, sigma, dist):
36
  zn = rng.normal(0, sigma*0.8)
37
  q = float(np.clip(base_q + wq*qn, 0.0, 0.99))
38
  z = float(np.clip(base_z + wz*zn, 0.0, 0.99))
39
- variance = abs(qn)+abs(zn)
40
  if variance > 0.15:
41
- status="critical"
42
  elif variance > 0.07:
43
- status="perturbed"
44
  else:
45
- status="nominal"
46
- return {"σ": round(sigma,6),"QΩ":q,"ζ_sync":z,"status":status}
47
 
48
- # ------------------ Main Runner -----------------------------
49
  def run(profile, dist, sigma, seed, samples):
50
  rng = _rng(int(seed))
51
- results = []
52
- for _ in range(samples):
53
- results.append(simulate_step(rng, profile, sigma, dist))
54
  q_mean = np.mean([r["QΩ"] for r in results])
55
  z_mean = np.mean([r["ζ_sync"] for r in results])
56
- summary = {
57
- "QΩ_mean": round(float(q_mean),6),
58
- "ζ_sync_mean": round(float(z_mean),6),
59
- "samples": samples,
60
  "profile": profile,
61
- "noise": sigma,
62
- "dist": dist,
63
- "status_majority": max(
64
- ["nominal","perturbed","critical"],
65
- key=lambda s: sum(1 for r in results if r["status"]==s)
66
- ),
67
  "rft_notice": LEGAL_NOTICE
68
  }
69
- return summary
70
 
71
- # ------------------ Gradio UI -------------------------------
72
  with gr.Blocks(title="RFT-Ω Total-Proof Kernel") as demo:
73
  gr.Markdown(f"### RFT-Ω Total-Proof Kernel ({RFT_VERSION}) \n"
74
  f"DOI: [{RFT_DOI}]({RFT_DOI}) \n{LEGAL_NOTICE}")
75
-
76
  with gr.Row():
77
  profile = gr.Dropdown(list(PROFILES.keys()), label="System Profile", value="AI / Neural")
78
  dist = gr.Radio(["gauss","uniform"], label="Noise Distribution", value="gauss")
 
79
  with gr.Row():
80
  sigma = gr.Slider(0.0, 0.3, value=0.05, step=0.01, label="Noise Scale (σ)")
81
- seed = gr.Number(value=123, precision=0, label="Seed")
82
- samples = gr.Slider(1, 20, value=5, step=1, label="Samples")
83
-
84
  run_btn = gr.Button("Run Simulation")
85
- output = gr.JSON(label="Run Summary")
86
 
87
  run_btn.click(run, inputs=[profile, dist, sigma, seed, samples], outputs=[output])
88
 
89
  # ------------------ Launch -------------------------------
90
  if __name__ == "__main__":
91
- demo.launch(server_name="0.0.0.0", server_port=7860, show_error=True, debug=False)
 
1
  # ============================================================
2
+ # RFT-Ω FRAMEWORK — TOTAL-PROOF API (Gradio Stable Build)
3
  # Author: Liam Grinstead | RFT Systems | All Rights Reserved
4
  # ============================================================
5
 
6
+ import json, hashlib, random
7
  from datetime import datetime
8
  import numpy as np
9
  import gradio as gr
 
16
  "Research validation use only. No reverse-engineering without written consent."
17
  )
18
 
19
+ # ------------------ System Profiles -------------------------
20
  PROFILES = {
21
  "AI / Neural": {"base": (0.86, 0.80), "w": (0.65, 0.35)},
22
  "SpaceX / Aerospace": {"base": (0.84, 0.79), "w": (0.60, 0.40)},
 
24
  "Extreme Perturbation": {"base": (0.82, 0.77), "w": (0.50, 0.50)},
25
  }
26
 
27
+ def _rng(seed:int):
28
+ return np.random.RandomState(seed)
29
 
30
  def simulate_step(rng, profile, sigma, dist):
31
  base_q, base_z = PROFILES[profile]["base"]
 
38
  zn = rng.normal(0, sigma*0.8)
39
  q = float(np.clip(base_q + wq*qn, 0.0, 0.99))
40
  z = float(np.clip(base_z + wz*zn, 0.0, 0.99))
41
+ variance = abs(qn) + abs(zn)
42
  if variance > 0.15:
43
+ status = "critical"
44
  elif variance > 0.07:
45
+ status = "perturbed"
46
  else:
47
+ status = "nominal"
48
+ return {"σ": round(sigma, 6), "QΩ": q, "ζ_sync": z, "status": status}
49
 
50
+ # ------------------ Simulation Runner -----------------------
51
  def run(profile, dist, sigma, seed, samples):
52
  rng = _rng(int(seed))
53
+ results = [simulate_step(rng, profile, sigma, dist) for _ in range(samples)]
 
 
54
  q_mean = np.mean([r["QΩ"] for r in results])
55
  z_mean = np.mean([r["ζ_sync"] for r in results])
56
+ majority = max(["nominal","perturbed","critical"],
57
+ key=lambda s: sum(1 for r in results if r["status"]==s))
58
+ return {
 
59
  "profile": profile,
60
+ "noise_scale": sigma,
61
+ "distribution": dist,
62
+ "QΩ_mean": round(float(q_mean), 6),
63
+ "ζ_sync_mean": round(float(z_mean), 6),
64
+ "status_majority": majority,
65
+ "timestamp_utc": datetime.utcnow().isoformat() + "Z",
66
  "rft_notice": LEGAL_NOTICE
67
  }
 
68
 
69
+ # ------------------ Gradio Interface ------------------------
70
  with gr.Blocks(title="RFT-Ω Total-Proof Kernel") as demo:
71
  gr.Markdown(f"### RFT-Ω Total-Proof Kernel ({RFT_VERSION}) \n"
72
  f"DOI: [{RFT_DOI}]({RFT_DOI}) \n{LEGAL_NOTICE}")
73
+
74
  with gr.Row():
75
  profile = gr.Dropdown(list(PROFILES.keys()), label="System Profile", value="AI / Neural")
76
  dist = gr.Radio(["gauss","uniform"], label="Noise Distribution", value="gauss")
77
+
78
  with gr.Row():
79
  sigma = gr.Slider(0.0, 0.3, value=0.05, step=0.01, label="Noise Scale (σ)")
80
+ seed = gr.Number(value=123, label="Seed (integer)")
81
+ samples = gr.Slider(1, 20, value=5, step=1, label="Samples per run")
82
+
83
  run_btn = gr.Button("Run Simulation")
84
+ output = gr.JSON(label="Simulation Results")
85
 
86
  run_btn.click(run, inputs=[profile, dist, sigma, seed, samples], outputs=[output])
87
 
88
  # ------------------ Launch -------------------------------
89
  if __name__ == "__main__":
90
+ demo.launch(server_name="0.0.0.0", server_port=7860)