Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -127,10 +127,6 @@ def _collect_pngs(folder: Path):
|
|
| 127 |
return sorted(str(p.resolve()) for p in folder.rglob("*.png"))
|
| 128 |
|
| 129 |
def _run_capture(cmd, cwd: Path, env: dict, timeout_s: int = 900):
|
| 130 |
-
"""
|
| 131 |
-
Run a subprocess and capture stdout/stderr.
|
| 132 |
-
Timeout prevents Spaces from hanging forever.
|
| 133 |
-
"""
|
| 134 |
try:
|
| 135 |
result = subprocess.run(
|
| 136 |
cmd,
|
|
@@ -252,7 +248,7 @@ def build_ui():
|
|
| 252 |
)
|
| 253 |
|
| 254 |
gr.HTML('<div id="down"></div>')
|
| 255 |
-
with gr.Group():
|
| 256 |
gr.Markdown(
|
| 257 |
"""
|
| 258 |
<div class="tq-card-title">DOWN / AntiDown</div>
|
|
@@ -264,11 +260,7 @@ def build_ui():
|
|
| 264 |
with gr.Column(scale=1, min_width=280):
|
| 265 |
run_down_btn = gr.Button("Run DOWN Pipeline", variant="primary", elem_id="btn_down")
|
| 266 |
with gr.Accordion("Advanced parameters", open=False):
|
| 267 |
-
down_eps = gr.Slider(
|
| 268 |
-
50, 500, step=50, value=200,
|
| 269 |
-
label="Episodes per phase"
|
| 270 |
-
)
|
| 271 |
-
|
| 272 |
with gr.Accordion("Run status / logs", open=False):
|
| 273 |
down_meta = gr.JSON(label="Run status", elem_id="down_meta")
|
| 274 |
gr.Markdown(
|
|
@@ -278,14 +270,11 @@ Tip: start with 200 episodes. Increase only when you need cleaner trends in plot
|
|
| 278 |
</div>
|
| 279 |
"""
|
| 280 |
)
|
| 281 |
-
|
| 282 |
with gr.Column(scale=2, min_width=420):
|
| 283 |
-
gr.Markdown(
|
| 284 |
-
'<div class="tq-card-title">Generated artifacts</div>'
|
| 285 |
-
)
|
| 286 |
down_gallery = gr.Gallery(
|
| 287 |
show_label=False,
|
| 288 |
-
columns=1,
|
| 289 |
height=240,
|
| 290 |
elem_id="down_gallery",
|
| 291 |
preview=True,
|
|
@@ -299,6 +288,7 @@ Tip: start with 200 episodes. Increase only when you need cleaner trends in plot
|
|
| 299 |
)
|
| 300 |
|
| 301 |
gr.Markdown("---")
|
|
|
|
| 302 |
gr.HTML('<div id="strange"></div>')
|
| 303 |
with gr.Group():
|
| 304 |
gr.Markdown(
|
|
@@ -311,10 +301,8 @@ Tip: start with 200 episodes. Increase only when you need cleaner trends in plot
|
|
| 311 |
with gr.Row(equal_height=True):
|
| 312 |
with gr.Column(scale=1, min_width=280):
|
| 313 |
run_strange_btn = gr.Button("Run STRANGE Pipeline", variant="primary", elem_id="btn_strange")
|
| 314 |
-
|
| 315 |
with gr.Accordion("Run status / logs", open=False):
|
| 316 |
strange_meta = gr.JSON(label="Run status", elem_id="strange_meta")
|
| 317 |
-
|
| 318 |
gr.Markdown(
|
| 319 |
"""
|
| 320 |
<div class="tq-card-subtitle">
|
|
@@ -322,7 +310,6 @@ This pipeline explores stability under non-stationarity: when the world changes
|
|
| 322 |
</div>
|
| 323 |
"""
|
| 324 |
)
|
| 325 |
-
|
| 326 |
with gr.Column(scale=2, min_width=420):
|
| 327 |
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
| 328 |
strange_gallery = gr.Gallery(
|
|
@@ -354,7 +341,6 @@ This pipeline explores stability under non-stationarity: when the world changes
|
|
| 354 |
|
| 355 |
return demo
|
| 356 |
|
| 357 |
-
|
| 358 |
demo = build_ui()
|
| 359 |
|
| 360 |
if __name__ == "__main__":
|
|
@@ -362,4 +348,4 @@ if __name__ == "__main__":
|
|
| 362 |
server_name="0.0.0.0",
|
| 363 |
server_port=int(os.getenv("PORT", "7860")),
|
| 364 |
show_api=False,
|
| 365 |
-
)
|
|
|
|
| 127 |
return sorted(str(p.resolve()) for p in folder.rglob("*.png"))
|
| 128 |
|
| 129 |
def _run_capture(cmd, cwd: Path, env: dict, timeout_s: int = 900):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
try:
|
| 131 |
result = subprocess.run(
|
| 132 |
cmd,
|
|
|
|
| 248 |
)
|
| 249 |
|
| 250 |
gr.HTML('<div id="down"></div>')
|
| 251 |
+
with gr.Group():
|
| 252 |
gr.Markdown(
|
| 253 |
"""
|
| 254 |
<div class="tq-card-title">DOWN / AntiDown</div>
|
|
|
|
| 260 |
with gr.Column(scale=1, min_width=280):
|
| 261 |
run_down_btn = gr.Button("Run DOWN Pipeline", variant="primary", elem_id="btn_down")
|
| 262 |
with gr.Accordion("Advanced parameters", open=False):
|
| 263 |
+
down_eps = gr.Slider(50, 500, step=50, value=200, label="Episodes per phase")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
with gr.Accordion("Run status / logs", open=False):
|
| 265 |
down_meta = gr.JSON(label="Run status", elem_id="down_meta")
|
| 266 |
gr.Markdown(
|
|
|
|
| 270 |
</div>
|
| 271 |
"""
|
| 272 |
)
|
|
|
|
| 273 |
with gr.Column(scale=2, min_width=420):
|
| 274 |
+
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
|
|
|
|
|
|
| 275 |
down_gallery = gr.Gallery(
|
| 276 |
show_label=False,
|
| 277 |
+
columns=1,
|
| 278 |
height=240,
|
| 279 |
elem_id="down_gallery",
|
| 280 |
preview=True,
|
|
|
|
| 288 |
)
|
| 289 |
|
| 290 |
gr.Markdown("---")
|
| 291 |
+
|
| 292 |
gr.HTML('<div id="strange"></div>')
|
| 293 |
with gr.Group():
|
| 294 |
gr.Markdown(
|
|
|
|
| 301 |
with gr.Row(equal_height=True):
|
| 302 |
with gr.Column(scale=1, min_width=280):
|
| 303 |
run_strange_btn = gr.Button("Run STRANGE Pipeline", variant="primary", elem_id="btn_strange")
|
|
|
|
| 304 |
with gr.Accordion("Run status / logs", open=False):
|
| 305 |
strange_meta = gr.JSON(label="Run status", elem_id="strange_meta")
|
|
|
|
| 306 |
gr.Markdown(
|
| 307 |
"""
|
| 308 |
<div class="tq-card-subtitle">
|
|
|
|
| 310 |
</div>
|
| 311 |
"""
|
| 312 |
)
|
|
|
|
| 313 |
with gr.Column(scale=2, min_width=420):
|
| 314 |
gr.Markdown('<div class="tq-card-title">Generated artifacts</div>')
|
| 315 |
strange_gallery = gr.Gallery(
|
|
|
|
| 341 |
|
| 342 |
return demo
|
| 343 |
|
|
|
|
| 344 |
demo = build_ui()
|
| 345 |
|
| 346 |
if __name__ == "__main__":
|
|
|
|
| 348 |
server_name="0.0.0.0",
|
| 349 |
server_port=int(os.getenv("PORT", "7860")),
|
| 350 |
show_api=False,
|
| 351 |
+
)
|