Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ operators = ["\\sin", "\\cos", "\\exp", "\\log", "\\nabla", "\\int", "\\frac{\\p
|
|
| 6 |
variables = ["x", "y", "t", "\\xi_1", "dP", "d\\Psi", "dT"]
|
| 7 |
|
| 8 |
def mutate_formula(base, epoch):
|
|
|
|
| 9 |
if epoch % 5 == 0:
|
| 10 |
base = f"\\int ({base}) \\, dx"
|
| 11 |
elif epoch % 7 == 0:
|
|
@@ -22,8 +23,14 @@ def run_epochs(n=50):
|
|
| 22 |
for epoch in range(1, n+1):
|
| 23 |
base = mutate_formula(base, epoch)
|
| 24 |
seal = hashlib.sha512(base.encode()).hexdigest()
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# === Mutation Forge (20 Epoch Run) ===
|
| 29 |
def run_mutation(seed, n=20):
|
|
@@ -32,8 +39,14 @@ def run_mutation(seed, n=20):
|
|
| 32 |
for epoch in range(1, n+1):
|
| 33 |
base = mutate_formula(base, epoch)
|
| 34 |
seal = hashlib.sha512(base.encode()).hexdigest()
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# === Gradio App ===
|
| 39 |
custom_theme = gr.themes.Base(
|
|
@@ -59,7 +72,10 @@ with gr.Blocks(theme=custom_theme) as demo:
|
|
| 59 |
|
| 60 |
with gr.Tab("Mutation Forge"):
|
| 61 |
gr.Markdown("### 🧬 Mutation Forge — Choose Your Symbolic Seed")
|
| 62 |
-
seed_dropdown = gr.Dropdown(
|
|
|
|
|
|
|
|
|
|
| 63 |
mutate_button = gr.Button("Mutate (20 Epochs)")
|
| 64 |
mutate_output = gr.Markdown()
|
| 65 |
mutate_button.click(fn=run_mutation, inputs=seed_dropdown, outputs=mutate_output)
|
|
|
|
| 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:
|
|
|
|
| 23 |
for epoch in range(1, n+1):
|
| 24 |
base = mutate_formula(base, epoch)
|
| 25 |
seal = hashlib.sha512(base.encode()).hexdigest()
|
| 26 |
+
scroll = (
|
| 27 |
+
f"## Epoch {epoch}\n\n"
|
| 28 |
+
f"$$ {base} $$\n\n"
|
| 29 |
+
f"**Immortality Glyph:** `{seal[:32]}...`\n\n"
|
| 30 |
+
"---\n\n"
|
| 31 |
+
)
|
| 32 |
+
formulas.append(scroll)
|
| 33 |
+
return "\n".join(formulas)
|
| 34 |
|
| 35 |
# === Mutation Forge (20 Epoch Run) ===
|
| 36 |
def run_mutation(seed, n=20):
|
|
|
|
| 39 |
for epoch in range(1, n+1):
|
| 40 |
base = mutate_formula(base, epoch)
|
| 41 |
seal = hashlib.sha512(base.encode()).hexdigest()
|
| 42 |
+
scroll = (
|
| 43 |
+
f"## Mutation Epoch {epoch}\n\n"
|
| 44 |
+
f"$$ {base} $$\n\n"
|
| 45 |
+
f"**Immortality Glyph:** `{seal[:32]}...`\n\n"
|
| 46 |
+
"---\n\n"
|
| 47 |
+
)
|
| 48 |
+
formulas.append(scroll)
|
| 49 |
+
return "\n".join(formulas)
|
| 50 |
|
| 51 |
# === Gradio App ===
|
| 52 |
custom_theme = gr.themes.Base(
|
|
|
|
| 72 |
|
| 73 |
with gr.Tab("Mutation Forge"):
|
| 74 |
gr.Markdown("### 🧬 Mutation Forge — Choose Your Symbolic Seed")
|
| 75 |
+
seed_dropdown = gr.Dropdown(
|
| 76 |
+
choices=operators + variables,
|
| 77 |
+
label="Select Seed Symbol or Formula"
|
| 78 |
+
)
|
| 79 |
mutate_button = gr.Button("Mutate (20 Epochs)")
|
| 80 |
mutate_output = gr.Markdown()
|
| 81 |
mutate_button.click(fn=run_mutation, inputs=seed_dropdown, outputs=mutate_output)
|