petter2025 commited on
Commit
0212d29
·
verified ·
1 Parent(s): a438938

Update ui/components.py

Browse files
Files changed (1) hide show
  1. ui/components.py +54 -80
ui/components.py CHANGED
@@ -1,108 +1,82 @@
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
8
- from typing import Dict, List, Any, Optional
9
  import gradio as gr
 
10
 
11
  # -----------------------------
12
- # Header & Footer
13
  # -----------------------------
14
- def create_header(version: str = "3.3.6", is_enterprise: bool = False):
15
- """Minimalist header with version and mode."""
16
- header_text = f"🚀 Agentic Reliability Framework v{version} · "
17
- header_text += "ENTERPRISE" if is_enterprise else "OSS Edition"
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
  # -----------------------------
34
- def create_tab1_incident_demo(
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
85
 
86
  # -----------------------------
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
 
 
1
  """
2
+ Minimalist, math-first Gradio UI for Agentic Reliability Framework (ARF)
3
+ Only Gradio components; Streamlit removed
 
4
  """
5
 
 
 
6
  import gradio as gr
7
+ from typing import Dict, List, Any
8
 
9
  # -----------------------------
10
+ # Header & Status
11
  # -----------------------------
12
+ def create_header() -> gr.HTML:
13
+ return gr.HTML("<h2>🚀 Agentic Reliability Framework v3.3.6 (OSS Edition)</h2>")
 
 
 
14
 
15
+ def create_status_bar() -> gr.HTML:
16
+ return gr.HTML(
17
+ " System Online · 🧠 Agentic Core Active · 📦 OSS Mode"
18
+ )
 
 
 
 
 
 
19
 
20
  # -----------------------------
21
  # Tab 1: Incident Demo
22
  # -----------------------------
23
+ def create_tab1_incident_demo() -> tuple:
24
+ """
25
+ Returns 12 Gradio components (matching previous unpacking in app.py)
26
+ """
27
+ scenario_dropdown = gr.Dropdown(choices=["Cache Miss Storm", "DB Latency Spike"], label="Incident Scenario")
28
+ scenario_description = gr.Textbox(value="Select a scenario to begin analysis.", label="Description")
29
+ metrics_display = gr.Textbox(value="Live Metrics: TBD", label="Metrics")
30
+ impact_display = gr.Textbox(value="Estimated Business Impact: TBD", label="Impact")
31
+
32
+ approval_display = gr.Textbox(value="Approval Status: N/A", label="Approval")
33
+ oss_results_display = gr.Textbox(value="OSS Results: N/A", label="OSS")
34
+ enterprise_results_display = gr.Textbox(value="Enterprise Results: N/A", label="Enterprise")
35
+
36
+ run_oss_btn = gr.Button("Run OSS Analysis")
37
+ execute_enterprise_btn = gr.Button("Execute Enterprise Healing")
38
+ require_human_btn = gr.Button("Require Human Approval")
39
+ run_demo_btn = gr.Button("Run Demo")
40
+
41
+ return (
42
+ scenario_dropdown, scenario_description, metrics_display, impact_display,
43
+ approval_display, oss_results_display, enterprise_results_display,
44
+ run_oss_btn, execute_enterprise_btn, require_human_btn, run_demo_btn, gr.Textbox(value="", visible=False)
45
+ )
 
 
 
 
46
 
47
  # -----------------------------
48
  # Tab 2: Business ROI
49
  # -----------------------------
50
+ def create_tab2_business_roi() -> tuple:
51
+ roi_display = gr.Textbox(value="ROI Calculator Output: TBD", label="ROI")
52
+ return (roi_display,)
 
 
 
 
 
53
 
54
  # -----------------------------
55
  # Tab 3: Enterprise Features
56
  # -----------------------------
57
+ def create_tab3_enterprise_features() -> tuple:
58
+ features_display = gr.Textbox(
59
+ value="- Self-Healing Agentic Core\n- Enhanced Monitoring\n- Auto-Scaling",
60
+ label="Enterprise Features"
61
+ )
62
+ return (features_display,)
 
 
63
 
64
  # -----------------------------
65
  # Tab 4: Audit Trail
66
  # -----------------------------
67
+ def create_tab4_audit_trail() -> tuple:
68
+ audit_display = gr.Textbox(value="Audit logs will appear here.", label="Audit Trail")
69
+ return (audit_display,)
 
 
 
 
 
70
 
71
  # -----------------------------
72
  # Tab 5: Learning Engine
73
  # -----------------------------
74
+ def create_tab5_learning_engine() -> tuple:
75
+ learning_display = gr.Textbox(value="Learning engine stats TBD.", label="Learning Engine")
76
+ return (learning_display,)
77
+
78
+ # -----------------------------
79
+ # Footer
80
+ # -----------------------------
81
+ def create_footer() -> gr.HTML:
82
+ return gr.HTML("ARF © 2025 · Self-Healing Agentic Systems")