Update ui/components.py
Browse files- ui/components.py +37 -7
ui/components.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
"""
|
| 2 |
Minimalist, Math-First ARF UI Components
|
| 3 |
Compatible with Gradio 6+ and Hugging Face Spaces
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
from __future__ import annotations
|
|
@@ -17,8 +18,16 @@ def create_header(version: str = "3.3.6", is_enterprise: bool = False):
|
|
| 17 |
return gr.Markdown(header_text, elem_classes=["mono"])
|
| 18 |
|
| 19 |
def create_footer():
|
|
|
|
| 20 |
return gr.Markdown("ARF 漏 2025 路 Self-Healing Agentic Systems", elem_classes=["mono"])
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# -----------------------------
|
| 23 |
# Tab 1: Incident Demo
|
| 24 |
# -----------------------------
|
|
@@ -26,37 +35,50 @@ def create_tab1_incident_demo(
|
|
| 26 |
scenarios: Dict[str, Any],
|
| 27 |
healing_intents: Optional[List[Dict[str, Any]]] = None
|
| 28 |
):
|
| 29 |
-
"""Minimalist Incident Demo tab
|
| 30 |
with gr.Column():
|
|
|
|
| 31 |
scenario_dropdown = gr.Dropdown(
|
| 32 |
-
label="Scenario",
|
| 33 |
choices=list(scenarios.keys()),
|
| 34 |
value=list(scenarios.keys())[0],
|
| 35 |
)
|
|
|
|
|
|
|
| 36 |
execution_mode = gr.Radio(
|
| 37 |
label="Execution Mode",
|
| 38 |
choices=["advisory", "approval", "autonomous"],
|
| 39 |
value="advisory",
|
| 40 |
)
|
|
|
|
|
|
|
| 41 |
run_button = gr.Button("Run Analysis", variant="primary")
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
return scenario_dropdown, execution_mode, run_button, metrics_display
|
| 44 |
|
| 45 |
# -----------------------------
|
| 46 |
# Tab 2: Business ROI
|
| 47 |
# -----------------------------
|
| 48 |
def create_tab2_business_roi():
|
|
|
|
| 49 |
with gr.Column():
|
| 50 |
-
roi_markdown = gr.Markdown(
|
|
|
|
|
|
|
|
|
|
| 51 |
return roi_markdown
|
| 52 |
|
| 53 |
# -----------------------------
|
| 54 |
# Tab 3: Enterprise Features
|
| 55 |
# -----------------------------
|
| 56 |
def create_tab3_enterprise_features():
|
|
|
|
| 57 |
with gr.Column():
|
| 58 |
features_markdown = gr.Markdown(
|
| 59 |
-
"## Enterprise Features\n- Full audit trail\n- Approval modes\n- Automated healing\n",
|
| 60 |
elem_classes=["mono"]
|
| 61 |
)
|
| 62 |
return features_markdown
|
|
@@ -65,14 +87,22 @@ def create_tab3_enterprise_features():
|
|
| 65 |
# Tab 4: Audit Trail
|
| 66 |
# -----------------------------
|
| 67 |
def create_tab4_audit_trail():
|
|
|
|
| 68 |
with gr.Column():
|
| 69 |
-
audit_markdown = gr.Markdown(
|
|
|
|
|
|
|
|
|
|
| 70 |
return audit_markdown
|
| 71 |
|
| 72 |
# -----------------------------
|
| 73 |
# Tab 5: Learning Engine
|
| 74 |
# -----------------------------
|
| 75 |
def create_tab5_learning_engine():
|
|
|
|
| 76 |
with gr.Column():
|
| 77 |
-
learning_markdown = gr.Markdown(
|
|
|
|
|
|
|
|
|
|
| 78 |
return learning_markdown
|
|
|
|
| 1 |
"""
|
| 2 |
Minimalist, Math-First ARF UI Components
|
| 3 |
Compatible with Gradio 6+ and Hugging Face Spaces
|
| 4 |
+
Version: v1.1
|
| 5 |
"""
|
| 6 |
|
| 7 |
from __future__ import annotations
|
|
|
|
| 18 |
return gr.Markdown(header_text, elem_classes=["mono"])
|
| 19 |
|
| 20 |
def create_footer():
|
| 21 |
+
"""Minimalist footer."""
|
| 22 |
return gr.Markdown("ARF 漏 2025 路 Self-Healing Agentic Systems", elem_classes=["mono"])
|
| 23 |
|
| 24 |
+
# -----------------------------
|
| 25 |
+
# Status Bar
|
| 26 |
+
# -----------------------------
|
| 27 |
+
def create_status_bar():
|
| 28 |
+
"""Minimalist status bar."""
|
| 29 |
+
return gr.Markdown("**Status:** idle", elem_classes=["mono"])
|
| 30 |
+
|
| 31 |
# -----------------------------
|
| 32 |
# Tab 1: Incident Demo
|
| 33 |
# -----------------------------
|
|
|
|
| 35 |
scenarios: Dict[str, Any],
|
| 36 |
healing_intents: Optional[List[Dict[str, Any]]] = None
|
| 37 |
):
|
| 38 |
+
"""Minimalist Incident Demo tab."""
|
| 39 |
with gr.Column():
|
| 40 |
+
# Scenario selector
|
| 41 |
scenario_dropdown = gr.Dropdown(
|
| 42 |
+
label="Incident Scenario",
|
| 43 |
choices=list(scenarios.keys()),
|
| 44 |
value=list(scenarios.keys())[0],
|
| 45 |
)
|
| 46 |
+
|
| 47 |
+
# Execution mode selector
|
| 48 |
execution_mode = gr.Radio(
|
| 49 |
label="Execution Mode",
|
| 50 |
choices=["advisory", "approval", "autonomous"],
|
| 51 |
value="advisory",
|
| 52 |
)
|
| 53 |
+
|
| 54 |
+
# Run analysis button
|
| 55 |
run_button = gr.Button("Run Analysis", variant="primary")
|
| 56 |
+
|
| 57 |
+
# Display area for metrics/results
|
| 58 |
+
metrics_display = gr.Markdown("```\nExecution state: idle\n```", elem_classes=["mono"])
|
| 59 |
+
|
| 60 |
return scenario_dropdown, execution_mode, run_button, metrics_display
|
| 61 |
|
| 62 |
# -----------------------------
|
| 63 |
# Tab 2: Business ROI
|
| 64 |
# -----------------------------
|
| 65 |
def create_tab2_business_roi():
|
| 66 |
+
"""Minimalist Business ROI display."""
|
| 67 |
with gr.Column():
|
| 68 |
+
roi_markdown = gr.Markdown(
|
| 69 |
+
"## Business Impact & ROI\n```\nROI calculations will appear here\n```",
|
| 70 |
+
elem_classes=["mono"]
|
| 71 |
+
)
|
| 72 |
return roi_markdown
|
| 73 |
|
| 74 |
# -----------------------------
|
| 75 |
# Tab 3: Enterprise Features
|
| 76 |
# -----------------------------
|
| 77 |
def create_tab3_enterprise_features():
|
| 78 |
+
"""Minimalist Enterprise Features display."""
|
| 79 |
with gr.Column():
|
| 80 |
features_markdown = gr.Markdown(
|
| 81 |
+
"## Enterprise Features\n- Full audit trail\n- Approval modes\n- Automated healing\n",
|
| 82 |
elem_classes=["mono"]
|
| 83 |
)
|
| 84 |
return features_markdown
|
|
|
|
| 87 |
# Tab 4: Audit Trail
|
| 88 |
# -----------------------------
|
| 89 |
def create_tab4_audit_trail():
|
| 90 |
+
"""Minimalist Audit Trail display."""
|
| 91 |
with gr.Column():
|
| 92 |
+
audit_markdown = gr.Markdown(
|
| 93 |
+
"## Audit Trail & History\n```\nRecent actions will appear here\n```",
|
| 94 |
+
elem_classes=["mono"]
|
| 95 |
+
)
|
| 96 |
return audit_markdown
|
| 97 |
|
| 98 |
# -----------------------------
|
| 99 |
# Tab 5: Learning Engine
|
| 100 |
# -----------------------------
|
| 101 |
def create_tab5_learning_engine():
|
| 102 |
+
"""Minimalist Learning Engine display."""
|
| 103 |
with gr.Column():
|
| 104 |
+
learning_markdown = gr.Markdown(
|
| 105 |
+
"## Learning Engine Stats\n```\nModel improvements and patterns\n```",
|
| 106 |
+
elem_classes=["mono"]
|
| 107 |
+
)
|
| 108 |
return learning_markdown
|