Spaces:
Sleeping
Sleeping
File size: 2,241 Bytes
9a9cb14 4f7778d 9a9cb14 87c2bd5 4f7778d 87c2bd5 04c0ae3 87c2bd5 9a9cb14 592aae5 9a9cb14 87c2bd5 04c0ae3 9a9cb14 4f7778d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# app.py
# Author: Liam Grinstead
# Purpose: Run agent simulations, mutations, falsifiability checks, and validation stages with automatic logging
from modules.agent_spawner import spawn_agent
from modules.mutation_engine import mutate_agent
from modules.field_visualizer import render_fields
from modules.falsifiability_bench import run_falsifiability
from modules.codex_logger import log_artifact
from modules.codex_viewer import load_codex
import gradio as gr
import stage1 # later add stage2, stage3, etc.
def run_simulation(agent_id, mutation_profile):
"""
Run a full simulation cycle:
1. Spawn agent
2. Apply mutation profile
3. Render fields (optional)
4. Run falsifiability bench
5. Log artifact with SHA-512 seal
"""
agent = spawn_agent(agent_id)
mutated = mutate_agent(agent, mutation_profile)
try:
render_fields(mutated)
except Exception:
pass
score, hash_val = run_falsifiability(mutated)
log_artifact(mutated, score, hash_val)
return mutated, hash_val
# ---------------- Validation Stage Wrapper ----------------
def run_stage(stage_name, mode, steps_or_epochs, batch, lr):
if stage_name == "Stage 1 — CIFAR-10 Baseline":
stage1.train(
mode=mode,
epochs=int(steps_or_epochs),
batch=int(batch),
lr=float(lr),
log_path="stage1_cifar10_log.jsonl"
)
return f"Stage 1 complete.\nMode: {mode}\nEpochs: {steps_or_epochs}\nBatch: {batch}\nLR: {lr}\nTelemetry saved to stage1_cifar10_log.jsonl"
else:
return "Stage not yet implemented."
# ---------------- Gradio Interface ----------------
iface = gr.Interface(
fn=run_stage,
inputs=[
gr.Dropdown(["Stage 1 — CIFAR-10 Baseline"], label="Select Stage"),
gr.Dropdown(["RFT", "BASE"], label="Mode"),
gr.Number(label="Epochs", value=5),
gr.Number(label="Batch Size", value=256),
gr.Number(label="Learning Rate", value=5e-4),
],
outputs="text",
title="RFTSystems — Symbolic Mutations & Validation",
description="Run agent simulations or validation stages of Rendered Frame Theory (RFT)."
)
if __name__ == "__main__":
iface.launch()
|