Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import gradio as gr
|
|
| 10 |
|
| 11 |
ROOT = Path(__file__).resolve().parent
|
| 12 |
|
| 13 |
-
DOWN_ROOT = ROOT / "
|
| 14 |
STRANGE_ROOT = ROOT / "Strange"
|
| 15 |
|
| 16 |
DOWN_GRAPHICS = DOWN_ROOT / "graphics"
|
|
@@ -37,19 +37,14 @@ def _collect_pngs(folder: Path):
|
|
| 37 |
# DOWN (Unified: Down + AntiDown)
|
| 38 |
# ============================================================
|
| 39 |
|
| 40 |
-
def run_down_all(
|
| 41 |
run_all = DOWN_ROOT / "run_all.py"
|
| 42 |
if not run_all.exists():
|
| 43 |
raise RuntimeError("Down/run_all.py not found")
|
| 44 |
|
| 45 |
_clean_pngs(DOWN_GRAPHICS)
|
| 46 |
|
| 47 |
-
cmd = [
|
| 48 |
-
sys.executable,
|
| 49 |
-
"run_all.py",
|
| 50 |
-
"--episodes",
|
| 51 |
-
str(int(episodes_per_phase)),
|
| 52 |
-
]
|
| 53 |
|
| 54 |
subprocess.run(
|
| 55 |
cmd,
|
|
@@ -62,18 +57,14 @@ def run_down_all(episodes_per_phase: int):
|
|
| 62 |
|
| 63 |
meta = {
|
| 64 |
"status": "completed",
|
| 65 |
-
"pipeline": "DOWN + AntiDown
|
| 66 |
-
"episodes_per_phase": int(episodes_per_phase),
|
| 67 |
"graphics_count": len(images),
|
| 68 |
"graphics_dir": str(DOWN_GRAPHICS),
|
| 69 |
}
|
| 70 |
|
| 71 |
return meta, images
|
| 72 |
|
| 73 |
-
|
| 74 |
-
# ============================================================
|
| 75 |
# STRANGE (Unified: Strange + AntiStrange)
|
| 76 |
-
# ============================================================
|
| 77 |
|
| 78 |
def run_strange_all():
|
| 79 |
run_all = STRANGE_ROOT / "run_all.py"
|
|
@@ -95,7 +86,7 @@ def run_strange_all():
|
|
| 95 |
|
| 96 |
meta = {
|
| 97 |
"status": "completed",
|
| 98 |
-
"pipeline": "STRANGE + AntiStrange
|
| 99 |
"graphics_count": len(images),
|
| 100 |
"graphics_dir": str(STRANGE_GRAPHICS),
|
| 101 |
}
|
|
@@ -109,15 +100,14 @@ def run_strange_all():
|
|
| 109 |
|
| 110 |
def build_ui():
|
| 111 |
with gr.Blocks(
|
| 112 |
-
title="TwoQuarks — QuarksLab
|
| 113 |
) as demo:
|
| 114 |
|
| 115 |
gr.Markdown(
|
| 116 |
"""
|
| 117 |
-
# TwoQuarks • QuarksLab
|
| 118 |
|
| 119 |
-
**
|
| 120 |
-
Each section launches a **single unified pipeline** and displays the **actual plots generated**.
|
| 121 |
"""
|
| 122 |
)
|
| 123 |
|
|
@@ -127,20 +117,19 @@ Each section launches a **single unified pipeline** and displays the **actual pl
|
|
| 127 |
gr.Markdown("## DOWN / AntiDown")
|
| 128 |
gr.Markdown(
|
| 129 |
"""
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
"""
|
| 133 |
)
|
| 134 |
|
| 135 |
down_eps = gr.Slider(
|
| 136 |
minimum=50,
|
| 137 |
-
maximum=
|
| 138 |
step=50,
|
| 139 |
value=200,
|
| 140 |
label="Episodes per phase",
|
| 141 |
)
|
| 142 |
|
| 143 |
-
run_down_btn = gr.Button("Run DOWN
|
| 144 |
|
| 145 |
down_meta = gr.JSON(label="Run status")
|
| 146 |
down_gallery = gr.Gallery(
|
|
@@ -163,12 +152,12 @@ This runs **one pipeline** that includes both quark and antiquark.
|
|
| 163 |
gr.Markdown("## STRANGE / AntiStrange")
|
| 164 |
gr.Markdown(
|
| 165 |
"""
|
| 166 |
-
|
| 167 |
-
|
| 168 |
"""
|
| 169 |
)
|
| 170 |
|
| 171 |
-
run_strange_btn = gr.Button("Run STRANGE
|
| 172 |
|
| 173 |
strange_meta = gr.JSON(label="Run status")
|
| 174 |
strange_gallery = gr.Gallery(
|
|
@@ -186,10 +175,11 @@ Runs **Strange + AntiStrange + dual comparison** as a single experiment.
|
|
| 186 |
gr.Markdown(
|
| 187 |
"""
|
| 188 |
---
|
| 189 |
-
### Notes
|
| 190 |
-
-
|
|
|
|
| 191 |
- Gradio does not import or orchestrate internal model logic.
|
| 192 |
-
- All visualizations are
|
| 193 |
"""
|
| 194 |
)
|
| 195 |
|
|
|
|
| 10 |
|
| 11 |
ROOT = Path(__file__).resolve().parent
|
| 12 |
|
| 13 |
+
DOWN_ROOT = ROOT / "down"
|
| 14 |
STRANGE_ROOT = ROOT / "Strange"
|
| 15 |
|
| 16 |
DOWN_GRAPHICS = DOWN_ROOT / "graphics"
|
|
|
|
| 37 |
# DOWN (Unified: Down + AntiDown)
|
| 38 |
# ============================================================
|
| 39 |
|
| 40 |
+
def run_down_all():
|
| 41 |
run_all = DOWN_ROOT / "run_all.py"
|
| 42 |
if not run_all.exists():
|
| 43 |
raise RuntimeError("Down/run_all.py not found")
|
| 44 |
|
| 45 |
_clean_pngs(DOWN_GRAPHICS)
|
| 46 |
|
| 47 |
+
cmd = [sys.executable, "run_all.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
subprocess.run(
|
| 50 |
cmd,
|
|
|
|
| 57 |
|
| 58 |
meta = {
|
| 59 |
"status": "completed",
|
| 60 |
+
"pipeline": "DOWN + AntiDown",
|
|
|
|
| 61 |
"graphics_count": len(images),
|
| 62 |
"graphics_dir": str(DOWN_GRAPHICS),
|
| 63 |
}
|
| 64 |
|
| 65 |
return meta, images
|
| 66 |
|
|
|
|
|
|
|
| 67 |
# STRANGE (Unified: Strange + AntiStrange)
|
|
|
|
| 68 |
|
| 69 |
def run_strange_all():
|
| 70 |
run_all = STRANGE_ROOT / "run_all.py"
|
|
|
|
| 86 |
|
| 87 |
meta = {
|
| 88 |
"status": "completed",
|
| 89 |
+
"pipeline": "STRANGE + AntiStrange",
|
| 90 |
"graphics_count": len(images),
|
| 91 |
"graphics_dir": str(STRANGE_GRAPHICS),
|
| 92 |
}
|
|
|
|
| 100 |
|
| 101 |
def build_ui():
|
| 102 |
with gr.Blocks(
|
| 103 |
+
title="TwoQuarks — QuarksLab",
|
| 104 |
) as demo:
|
| 105 |
|
| 106 |
gr.Markdown(
|
| 107 |
"""
|
| 108 |
+
# TwoQuarks • QuarksLab
|
| 109 |
|
| 110 |
+
**Run Models. Real artifacts. Real Models.**
|
|
|
|
| 111 |
"""
|
| 112 |
)
|
| 113 |
|
|
|
|
| 117 |
gr.Markdown("## DOWN / AntiDown")
|
| 118 |
gr.Markdown(
|
| 119 |
"""
|
| 120 |
+
The Down / AntiDown models are reinforcement learning agents
|
| 121 |
+
designed to expose and analyze failure modes under deceptive reward conditions."""
|
|
|
|
| 122 |
)
|
| 123 |
|
| 124 |
down_eps = gr.Slider(
|
| 125 |
minimum=50,
|
| 126 |
+
maximum=500,
|
| 127 |
step=50,
|
| 128 |
value=200,
|
| 129 |
label="Episodes per phase",
|
| 130 |
)
|
| 131 |
|
| 132 |
+
run_down_btn = gr.Button("Run DOWN Model")
|
| 133 |
|
| 134 |
down_meta = gr.JSON(label="Run status")
|
| 135 |
down_gallery = gr.Gallery(
|
|
|
|
| 152 |
gr.Markdown("## STRANGE / AntiStrange")
|
| 153 |
gr.Markdown(
|
| 154 |
"""
|
| 155 |
+
Strange / AntiStrange are reinforcement learning agents
|
| 156 |
+
designed to study failure under hidden regime shifts and phase transitions.
|
| 157 |
"""
|
| 158 |
)
|
| 159 |
|
| 160 |
+
run_strange_btn = gr.Button("Run STRANGE Model")
|
| 161 |
|
| 162 |
strange_meta = gr.JSON(label="Run status")
|
| 163 |
strange_gallery = gr.Gallery(
|
|
|
|
| 175 |
gr.Markdown(
|
| 176 |
"""
|
| 177 |
---
|
| 178 |
+
### Notes:
|
| 179 |
+
- This lab, its models & the TwoQuarks website,
|
| 180 |
+
are developed end to end by Jaime Ledesma.
|
| 181 |
- Gradio does not import or orchestrate internal model logic.
|
| 182 |
+
- All visualizations are the result produced by the model.
|
| 183 |
"""
|
| 184 |
)
|
| 185 |
|