Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
| 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]}...`\n\n")
|
| 27 |
-
return "\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", color="white"); plt.ylabel("Complexity Score", color="white")
|
| 42 |
-
plt.grid(alpha=0.3); plt.gca().set_facecolor("black")
|
| 43 |
-
plt.tick_params(colors="white")
|
| 44 |
-
return plt.gcf()
|
| 45 |
-
|
| 46 |
-
# === Gradio App ===
|
| 47 |
-
custom_theme = gr.themes.Base(
|
| 48 |
-
primary_hue="cyan", # supported hue
|
| 49 |
-
secondary_hue="pink", # supported hue
|
| 50 |
-
neutral_hue="gray", # supported hue
|
| 51 |
-
)
|
| 52 |
-
|
| 53 |
-
with gr.Blocks(theme=custom_theme) as demo:
|
| 54 |
-
gr.Markdown(
|
| 55 |
-
"""
|
| 56 |
-
# 🌌 Resonance Atlas — The Living Codex
|
| 57 |
-
Immerse yourself in evolving scrolls of mathematics.
|
| 58 |
-
Formulas mutate into higher symbolic forms across epochs, sealed with Immortality Glyphs.
|
| 59 |
-
""",
|
| 60 |
-
)
|
| 61 |
-
|
| 62 |
-
with gr.Tab("Codex Scrolls"):
|
| 63 |
-
gr.Markdown("### 🔢 Live Epoch Run")
|
| 64 |
-
run_button = gr.Button("Run 50 Epochs")
|
| 65 |
-
output = gr.Markdown()
|
| 66 |
-
run_button.click(fn=run_epochs, inputs=None, outputs=output)
|
| 67 |
-
|
| 68 |
-
with gr.Tab("Complexity Timeline"):
|
| 69 |
-
gr.Markdown("### 📈 Complexity Growth")
|
| 70 |
-
plot_button = gr.Button("Show Complexity Growth")
|
| 71 |
-
plot_output = gr.Plot()
|
| 72 |
-
plot_button.click(fn=plot_complexity, inputs=None, outputs=plot_output)
|
| 73 |
-
|
| 74 |
-
with gr.Tab("Immersion Mode"):
|
| 75 |
-
gr.Markdown("### 🌠 Immersion Mode")
|
| 76 |
-
gr.Markdown("Formulas pulse, glyphs glow, epochs unfold in full-screen dynamic visualization.")
|
| 77 |
-
|
| 78 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|