Spaces:
Paused
Paused
Commit Β·
0c2a6e7
1
Parent(s): c0c63ff
Add auto-refresh timer and dark theme CSS
Browse files- gr.Timer(10) polls training state every 10s automatically
- Dark theme via CSS (no theme= param to avoid deprecation noise)
- Monospace log box, styled status display
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -423,24 +423,31 @@ def _get_state():
|
|
| 423 |
|
| 424 |
|
| 425 |
CSS = """
|
| 426 |
-
.
|
| 427 |
-
.
|
| 428 |
-
|
| 429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
footer { display: none !important; }
|
| 431 |
"""
|
| 432 |
|
| 433 |
-
with gr.Blocks(title="SpindleFlow RL Training",
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
"Click **Refresh** every 30 s to see live progress. "
|
| 440 |
-
"When complete the model is pushed to your HF Hub repo."
|
| 441 |
-
)
|
| 442 |
|
| 443 |
-
with gr.Row(
|
| 444 |
status_box = gr.Textbox(
|
| 445 |
label="Status",
|
| 446 |
value="β³ Starting...",
|
|
@@ -448,7 +455,7 @@ with gr.Blocks(title="SpindleFlow RL Training", theme=gr.themes.Soft(), css=CSS)
|
|
| 448 |
scale=4,
|
| 449 |
elem_classes="status-box",
|
| 450 |
)
|
| 451 |
-
refresh_btn = gr.Button("π Refresh", scale=1, variant="primary"
|
| 452 |
|
| 453 |
log_box = gr.Textbox(
|
| 454 |
label="Training log (last 120 lines)",
|
|
@@ -459,6 +466,8 @@ with gr.Blocks(title="SpindleFlow RL Training", theme=gr.themes.Soft(), css=CSS)
|
|
| 459 |
elem_classes="log-box",
|
| 460 |
)
|
| 461 |
|
|
|
|
|
|
|
| 462 |
refresh_btn.click(fn=_get_state, outputs=[status_box, log_box])
|
| 463 |
demo.load(fn=_get_state, outputs=[status_box, log_box])
|
| 464 |
|
|
|
|
| 423 |
|
| 424 |
|
| 425 |
CSS = """
|
| 426 |
+
body, .gradio-container { background: #0f172a !important; }
|
| 427 |
+
.status-box textarea {
|
| 428 |
+
font-size: 1.05rem !important; font-weight: 700 !important;
|
| 429 |
+
background: #1e293b !important; color: #f1f5f9 !important;
|
| 430 |
+
border: 1px solid #334155 !important;
|
| 431 |
+
}
|
| 432 |
+
.log-box textarea {
|
| 433 |
+
font-family: 'Courier New', monospace !important;
|
| 434 |
+
font-size: 0.8rem !important; line-height: 1.5 !important;
|
| 435 |
+
background: #0f172a !important; color: #94a3b8 !important;
|
| 436 |
+
border: 1px solid #1e293b !important;
|
| 437 |
+
}
|
| 438 |
+
h1 { color: #f1f5f9 !important; }
|
| 439 |
+
p, label { color: #94a3b8 !important; }
|
| 440 |
footer { display: none !important; }
|
| 441 |
"""
|
| 442 |
|
| 443 |
+
with gr.Blocks(title="SpindleFlow RL Training", css=CSS) as demo:
|
| 444 |
+
gr.Markdown("# π€ SpindleFlow RL β Training Dashboard")
|
| 445 |
+
gr.Markdown(
|
| 446 |
+
"Auto-refreshes every 10 s. "
|
| 447 |
+
"When complete the trained model is pushed to your HF Hub repo."
|
| 448 |
+
)
|
|
|
|
|
|
|
|
|
|
| 449 |
|
| 450 |
+
with gr.Row():
|
| 451 |
status_box = gr.Textbox(
|
| 452 |
label="Status",
|
| 453 |
value="β³ Starting...",
|
|
|
|
| 455 |
scale=4,
|
| 456 |
elem_classes="status-box",
|
| 457 |
)
|
| 458 |
+
refresh_btn = gr.Button("π Refresh now", scale=1, variant="primary")
|
| 459 |
|
| 460 |
log_box = gr.Textbox(
|
| 461 |
label="Training log (last 120 lines)",
|
|
|
|
| 466 |
elem_classes="log-box",
|
| 467 |
)
|
| 468 |
|
| 469 |
+
timer = gr.Timer(value=10)
|
| 470 |
+
timer.tick(fn=_get_state, outputs=[status_box, log_box])
|
| 471 |
refresh_btn.click(fn=_get_state, outputs=[status_box, log_box])
|
| 472 |
demo.load(fn=_get_state, outputs=[status_box, log_box])
|
| 473 |
|