Update ui/components.py
Browse files- ui/components.py +53 -21
ui/components.py
CHANGED
|
@@ -1,12 +1,6 @@
|
|
| 1 |
"""
|
| 2 |
Minimalist, Math-First UI Components for ARF OSS
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
Principles:
|
| 6 |
-
- Deterministic layout
|
| 7 |
-
- Low entropy
|
| 8 |
-
- Systems-first semantics
|
| 9 |
-
- OSS honesty
|
| 10 |
"""
|
| 11 |
|
| 12 |
import gradio as gr
|
|
@@ -14,16 +8,15 @@ from typing import Dict, Any
|
|
| 14 |
|
| 15 |
|
| 16 |
# ============================================================
|
| 17 |
-
# HEADER
|
| 18 |
# ============================================================
|
| 19 |
def create_header(version: str, mock_mode: bool) -> gr.HTML:
|
| 20 |
mode = "mock" if mock_mode else "live"
|
| 21 |
-
|
| 22 |
return gr.HTML(
|
| 23 |
f"""
|
| 24 |
-
<div style="font-family: monospace;
|
| 25 |
<strong>Agentic Reliability Framework</strong><br/>
|
| 26 |
-
version={version} · mode={mode} ·
|
| 27 |
</div>
|
| 28 |
<hr/>
|
| 29 |
"""
|
|
@@ -31,11 +24,10 @@ def create_header(version: str, mock_mode: bool) -> gr.HTML:
|
|
| 31 |
|
| 32 |
|
| 33 |
# ============================================================
|
| 34 |
-
# STATUS BAR
|
| 35 |
# ============================================================
|
| 36 |
def create_status_bar(system_online: bool = True) -> gr.HTML:
|
| 37 |
status = "ONLINE" if system_online else "OFFLINE"
|
| 38 |
-
|
| 39 |
return gr.HTML(
|
| 40 |
f"""
|
| 41 |
<div style="font-family: monospace; font-size: 13px;">
|
|
@@ -69,7 +61,7 @@ def create_tab1_incident_demo(
|
|
| 69 |
run_button = gr.Button("Run Analysis", variant="primary")
|
| 70 |
|
| 71 |
metrics = gr.Markdown(
|
| 72 |
-
"
|
| 73 |
elem_classes=["mono"],
|
| 74 |
)
|
| 75 |
|
|
@@ -81,13 +73,13 @@ def create_tab1_incident_demo(
|
|
| 81 |
# ============================================================
|
| 82 |
def create_tab2_business_roi():
|
| 83 |
with gr.Column():
|
| 84 |
-
gr.Markdown("### Impact Estimation
|
| 85 |
|
| 86 |
roi_output = gr.Markdown(
|
| 87 |
"""
|
| 88 |
-
loss_rate_usd_per_hour = 0
|
| 89 |
-
recovery_time_minutes = ∅
|
| 90 |
-
|
| 91 |
""",
|
| 92 |
elem_classes=["mono"],
|
| 93 |
)
|
|
@@ -104,9 +96,9 @@ def create_tab3_enterprise_features():
|
|
| 104 |
|
| 105 |
gr.Markdown(
|
| 106 |
"""
|
| 107 |
-
autonomous_execution = false
|
| 108 |
-
policy_engine = locked
|
| 109 |
-
sla_enforcement = locked
|
| 110 |
|
| 111 |
status = OSS_LIMITED
|
| 112 |
""",
|
|
@@ -119,3 +111,43 @@ def create_tab3_enterprise_features():
|
|
| 119 |
# ============================================================
|
| 120 |
def create_tab4_audit_trail():
|
| 121 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
Minimalist, Math-First UI Components for ARF OSS
|
| 3 |
+
HF Spaces + Gradio compatible
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
import gradio as gr
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
# ============================================================
|
| 11 |
+
# HEADER
|
| 12 |
# ============================================================
|
| 13 |
def create_header(version: str, mock_mode: bool) -> gr.HTML:
|
| 14 |
mode = "mock" if mock_mode else "live"
|
|
|
|
| 15 |
return gr.HTML(
|
| 16 |
f"""
|
| 17 |
+
<div style="font-family: monospace;">
|
| 18 |
<strong>Agentic Reliability Framework</strong><br/>
|
| 19 |
+
version={version} · mode={mode} · edition=oss
|
| 20 |
</div>
|
| 21 |
<hr/>
|
| 22 |
"""
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
# ============================================================
|
| 27 |
+
# STATUS BAR
|
| 28 |
# ============================================================
|
| 29 |
def create_status_bar(system_online: bool = True) -> gr.HTML:
|
| 30 |
status = "ONLINE" if system_online else "OFFLINE"
|
|
|
|
| 31 |
return gr.HTML(
|
| 32 |
f"""
|
| 33 |
<div style="font-family: monospace; font-size: 13px;">
|
|
|
|
| 61 |
run_button = gr.Button("Run Analysis", variant="primary")
|
| 62 |
|
| 63 |
metrics = gr.Markdown(
|
| 64 |
+
"execution_state = idle",
|
| 65 |
elem_classes=["mono"],
|
| 66 |
)
|
| 67 |
|
|
|
|
| 73 |
# ============================================================
|
| 74 |
def create_tab2_business_roi():
|
| 75 |
with gr.Column():
|
| 76 |
+
gr.Markdown("### Impact Estimation")
|
| 77 |
|
| 78 |
roi_output = gr.Markdown(
|
| 79 |
"""
|
| 80 |
+
loss_rate_usd_per_hour = 0
|
| 81 |
+
recovery_time_minutes = ∅
|
| 82 |
+
expected_savings = ∅
|
| 83 |
""",
|
| 84 |
elem_classes=["mono"],
|
| 85 |
)
|
|
|
|
| 96 |
|
| 97 |
gr.Markdown(
|
| 98 |
"""
|
| 99 |
+
autonomous_execution = false
|
| 100 |
+
policy_engine = locked
|
| 101 |
+
sla_enforcement = locked
|
| 102 |
|
| 103 |
status = OSS_LIMITED
|
| 104 |
""",
|
|
|
|
| 111 |
# ============================================================
|
| 112 |
def create_tab4_audit_trail():
|
| 113 |
with gr.Column():
|
| 114 |
+
gr.Markdown("### Execution Trace")
|
| 115 |
+
|
| 116 |
+
audit_df = gr.Dataframe(
|
| 117 |
+
headers=["step", "state", "Δt_ms"],
|
| 118 |
+
datatype=["str", "str", "number"],
|
| 119 |
+
row_count=6,
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
return audit_df
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# ============================================================
|
| 126 |
+
# TAB 5 — LEARNING ENGINE
|
| 127 |
+
# ============================================================
|
| 128 |
+
def create_tab5_learning_engine():
|
| 129 |
+
with gr.Column():
|
| 130 |
+
gr.Markdown("### Learning State")
|
| 131 |
+
|
| 132 |
+
gr.Markdown(
|
| 133 |
+
"""
|
| 134 |
+
vector_memory = enabled
|
| 135 |
+
feedback_loop = passive
|
| 136 |
+
online_learning = disabled
|
| 137 |
+
""",
|
| 138 |
+
elem_classes=["mono"],
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
# ============================================================
|
| 143 |
+
# FOOTER
|
| 144 |
+
# ============================================================
|
| 145 |
+
def create_footer() -> gr.HTML:
|
| 146 |
+
return gr.HTML(
|
| 147 |
+
"""
|
| 148 |
+
<hr/>
|
| 149 |
+
<div style="font-family: monospace; font-size: 12px;">
|
| 150 |
+
ARF OSS · Apache-2.0 · 2025
|
| 151 |
+
</div>
|
| 152 |
+
"""
|
| 153 |
+
)
|