RFTSystems commited on
Commit
1496c17
·
verified ·
1 Parent(s): 439e140

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -20
app.py CHANGED
@@ -1,29 +1,64 @@
1
  import gradio as gr
2
- import hashlib, random, math
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
- # === Epoch Formula Generator ===
5
  def run_epochs(n=50):
6
- results = []
 
7
  for epoch in range(1, n+1):
8
- coeff = random.randint(1,5)
9
- offset = epoch
10
- formula = f"\\Lambda(\\xi_1, dP, d\\Psi, dT) = dP \\cdot \\xi_1^{coeff} + \\sqrt{{d\\Psi + dT + {offset}}} + \\log(dT+{offset+1}) - \\sin(d\\Psi+\\xi_1)"
11
- seal = hashlib.sha512(formula.encode()).hexdigest()
12
- results.append({
13
- "Epoch": epoch,
14
- "Formula (LaTeX)": formula,
15
- "Seal": seal
16
- })
17
- return results
18
-
19
- # === Gradio Integration ===
 
 
 
 
 
 
 
 
 
 
 
20
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
21
- gr.Markdown("# 🔢 Live Epoch Run Formula Evolution")
22
- gr.Markdown("Watch 50 epochs unfold as formulas mutate into higher symbolic forms.")
 
 
 
 
 
23
 
24
- run_button = gr.Button("Run 50 Epochs")
25
- output = gr.JSON(label="Epoch Results")
 
 
26
 
27
- run_button.click(fn=run_epochs, inputs=None, outputs=output)
 
 
28
 
29
  demo.launch()
 
1
  import gradio as gr
2
+ import hashlib, random, matplotlib.pyplot as plt
3
+
4
+ # === Mutation Engine ===
5
+ operators = ["\\sin", "\\cos", "\\exp", "\\log", "\\nabla", "\\int", "\\frac{\\partial}{\\partial t}"]
6
+ variables = ["x", "y", "t", "\\xi_1", "dP", "d\\Psi", "dT"]
7
+
8
+ def mutate_formula(base, epoch):
9
+ # Structural mutation rules
10
+ if epoch % 5 == 0:
11
+ base = f"\\int ({base}) \\, dx"
12
+ elif epoch % 7 == 0:
13
+ base = f"\\nabla \\cdot ({base})"
14
+ else:
15
+ new_term = random.choice(operators) + "(" + random.choice(variables) + ")"
16
+ base = base + " + " + new_term
17
+ return base
18
 
 
19
  def run_epochs(n=50):
20
+ formulas = []
21
+ base = "x^2 + 1" # starting point
22
  for epoch in range(1, n+1):
23
+ base = mutate_formula(base, epoch)
24
+ seal = hashlib.sha512(base.encode()).hexdigest()
25
+ complexity = base.count("\\") + base.count("+")
26
+ formulas.append(f"**Epoch {epoch}**\n\n$$ {base} $$\n\nImmortality Glyph: `{seal[:32]}...`")
27
+ return "\n\n---\n\n".join(formulas)
28
+
29
+ # === Complexity Plot ===
30
+ def plot_complexity(n=50):
31
+ base = "x^2 + 1"
32
+ complexities = []
33
+ epochs = list(range(1, n+1))
34
+ for epoch in epochs:
35
+ base = mutate_formula(base, epoch)
36
+ complexity = base.count("\\") + base.count("+")
37
+ complexities.append(complexity)
38
+ plt.figure(figsize=(8,5), facecolor="black")
39
+ plt.plot(epochs, complexities, color="cyan", marker="o", linestyle="--")
40
+ plt.title("Symbolic Complexity Growth Across Epochs", color="white")
41
+ plt.xlabel("Epoch"); plt.ylabel("Complexity Score")
42
+ plt.grid(alpha=0.3); plt.gca().set_facecolor("black")
43
+ return plt.gcf()
44
+
45
+ # === Gradio App ===
46
  with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
47
+ gr.Markdown("# 🌌 Resonance AtlasThe Living Codex")
48
+ gr.Markdown("Watch formulas evolve into higher symbolic forms across epochs. Each scroll is sealed with an Immortality Glyph.")
49
+
50
+ with gr.Tab("Codex Scrolls"):
51
+ run_button = gr.Button("Run 50 Epochs")
52
+ output = gr.Markdown()
53
+ run_button.click(fn=run_epochs, inputs=None, outputs=output)
54
 
55
+ with gr.Tab("Complexity Timeline"):
56
+ plot_button = gr.Button("Show Complexity Growth")
57
+ plot_output = gr.Plot()
58
+ plot_button.click(fn=plot_complexity, inputs=None, outputs=plot_output)
59
 
60
+ with gr.Tab("Immersion Mode"):
61
+ gr.Markdown("### Full‑screen dynamic visualization coming soon…")
62
+ gr.Markdown("Formulas pulse, glyphs glow, epochs unfold.")
63
 
64
  demo.launch()