burtenshaw commited on
Commit
d34ca77
Β·
1 Parent(s): 61c84e0

simplify interface again

Browse files
Files changed (1) hide show
  1. app.py +31 -61
app.py CHANGED
@@ -594,35 +594,6 @@ def get_system_status(random_string: str = "") -> str:
594
  completed_runs = len([r for r in runs if r.get("status") == "completed"])
595
  failed_runs = len([r for r in runs if r.get("status") == "failed"])
596
 
597
- available_tasks = [
598
- "text-classification",
599
- "llm-sft",
600
- "llm-dpo",
601
- "llm-orpo",
602
- "image-classification",
603
- ]
604
-
605
- available_backends = [
606
- "local",
607
- "spaces-t4-small",
608
- "spaces-t4-medium",
609
- "spaces-a10g-large",
610
- "spaces-a10g-small",
611
- "spaces-a100-large",
612
- "spaces-l4x1",
613
- "spaces-l4x4",
614
- ]
615
-
616
- # Extract nested expressions to avoid f-string nesting
617
- tasks_list = chr(10).join(f" β€’ {task}" for task in available_tasks)
618
- backends_list = chr(10).join(
619
- f" β€’ {backend}" for backend in available_backends[:10]
620
- )
621
- backends_more = (
622
- f" ... and {len(available_backends) - 10} more"
623
- if len(available_backends) > 10
624
- else ""
625
- )
626
  wandb_api_status = (
627
  "βœ… Configured" if os.environ.get("WANDB_API_KEY") else "❌ Missing"
628
  )
@@ -632,31 +603,32 @@ def get_system_status(random_string: str = "") -> str:
632
  else "❌ System metrics only"
633
  )
634
 
635
- status_text = f"""πŸš€ AutoTrain Gradio MCP Server - System Status
636
-
637
- **Server Status:** Running
638
- **Total Runs:** {total_runs}
639
- **Active Runs:** {running_runs}
640
- **Completed Runs:** {completed_runs}
641
- **Failed Runs:** {failed_runs}
642
-
643
- **Available Tasks:** {len(available_tasks)}
644
- {tasks_list}
645
-
646
- **Available Backends:** {len(available_backends)}
647
- {backends_list}
648
- {backends_more}
649
-
650
- πŸ’‘ **Access Points:**
651
- β€’ Gradio UI: http://SPACE_URL
652
- β€’ MCP Server: http://SPACE_URL/gradio_api/mcp/sse
653
- β€’ MCP Schema: http://SPACE_URL/gradio_api/mcp/schema
654
-
655
- πŸ› οΈ **W&B Integration:**
656
- β€’ Project: {WANDB_PROJECT}
657
- β€’ API Key: {wandb_api_status}
658
- β€’ Training Metrics: {wandb_metrics_status}
659
- β€’ Set WANDB_API_KEY for complete training metrics logging"""
 
660
 
661
  return status_text
662
 
@@ -804,18 +776,16 @@ with gr.Blocks(
804
 
805
  with gr.Tabs():
806
  # Dashboard Tab
807
- with gr.Tab("πŸ“Š Dashboard"):
808
  with gr.Row():
809
- gr.Markdown("## Training Runs")
810
- refresh_btn = gr.Button("πŸ”„ Refresh", variant="secondary")
811
  runs_table = gr.Dataframe(
812
  value=fetch_runs_for_ui(), interactive=False, datatype="markdown"
813
  )
814
  with gr.Row():
815
- gr.Markdown("## Quick Stats")
816
- stats = gr.Textbox(
817
- value=get_system_status(), interactive=False, lines=15
818
- )
819
 
820
  # MCP Tools Tab
821
  with gr.Tab("πŸ”§ MCP Tools"):
 
594
  completed_runs = len([r for r in runs if r.get("status") == "completed"])
595
  failed_runs = len([r for r in runs if r.get("status") == "failed"])
596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  wandb_api_status = (
598
  "βœ… Configured" if os.environ.get("WANDB_API_KEY") else "❌ Missing"
599
  )
 
603
  else "❌ System metrics only"
604
  )
605
 
606
+ status_text = f"""## βš™οΈ System Status
607
+
608
+ ### πŸ“Š Run Statistics
609
+ | Metric | Count |
610
+ |--------|-------|
611
+ | **Server Status** | βœ… Running |
612
+ | **Total Runs** | {total_runs} |
613
+ | **Active Runs** | {running_runs} |
614
+ | **Completed Runs** | {completed_runs} |
615
+ | **Failed Runs** | {failed_runs} |
616
+
617
+ ### πŸ’‘ Access Points
618
+ | Service | URL |
619
+ |---------|-----|
620
+ | **Gradio UI** | http://SPACE_URL |
621
+ | **MCP Server** | http://SPACE_URL/gradio_api/mcp/sse |
622
+ | **MCP Schema** | http://SPACE_URL/gradio_api/mcp/schema |
623
+
624
+ ### πŸ› οΈ W&B Integration
625
+ | Component | Status |
626
+ |-----------|--------|
627
+ | **Project** | {WANDB_PROJECT} |
628
+ | **API Key** | {wandb_api_status} |
629
+ | **Training Metrics** | {wandb_metrics_status} |
630
+
631
+ πŸ’‘ **Note:** Set WANDB_API_KEY for complete training metrics logging"""
632
 
633
  return status_text
634
 
 
776
 
777
  with gr.Tabs():
778
  # Dashboard Tab
779
+ with gr.Tab("πŸ“Š Training Runs"):
780
  with gr.Row():
 
 
781
  runs_table = gr.Dataframe(
782
  value=fetch_runs_for_ui(), interactive=False, datatype="markdown"
783
  )
784
  with gr.Row():
785
+ refresh_btn = gr.Button("πŸ”„ Refresh", variant="secondary")
786
+
787
+ with gr.Tab("πŸ”§ System Status"):
788
+ stats = gr.Markdown(value=get_system_status())
789
 
790
  # MCP Tools Tab
791
  with gr.Tab("πŸ”§ MCP Tools"):