Spaces:
Runtime error
Runtime error
burtenshaw
commited on
Commit
Β·
d34ca77
1
Parent(s):
61c84e0
simplify interface again
Browse files
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"""
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
**
|
| 641 |
-
**
|
| 642 |
-
|
| 643 |
-
**
|
| 644 |
-
{
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
|
|
|
| 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("π
|
| 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.
|
| 816 |
-
|
| 817 |
-
|
| 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"):
|