garvitsachdeva Claude Sonnet 4.6 commited on
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>

Files changed (1) hide show
  1. app.py +24 -15
app.py CHANGED
@@ -423,24 +423,31 @@ def _get_state():
423
 
424
 
425
  CSS = """
426
- .status-box textarea { font-size: 1.1rem !important; font-weight: 600 !important; }
427
- .log-box textarea { font-family: monospace !important; font-size: 0.82rem !important; }
428
- .title-md h1 { font-size: 2rem !important; margin-bottom: 0.2rem !important; }
429
- .subtitle-md p { color: #64748b !important; margin-top: 0 !important; }
 
 
 
 
 
 
 
 
 
 
430
  footer { display: none !important; }
431
  """
432
 
433
- with gr.Blocks(title="SpindleFlow RL Training", theme=gr.themes.Soft(), css=CSS) as demo:
434
- with gr.Column(elem_classes="title-md"):
435
- gr.Markdown("# πŸ€– SpindleFlow RL β€” Training Dashboard")
436
- with gr.Column(elem_classes="subtitle-md"):
437
- gr.Markdown(
438
- "Training runs automatically on startup. "
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(equal_height=True):
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", size="lg")
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