petter2025's picture
Update ui/components.py
7655fd6 verified
raw
history blame
2.86 kB
"""
Minimalist, Math-First ARF UI Components
Compatible with Gradio 6+ and Hugging Face Spaces
"""
from __future__ import annotations
from typing import Dict, List, Any, Optional
import gradio as gr
# -----------------------------
# Header & Footer
# -----------------------------
def create_header(version: str = "3.3.6", is_enterprise: bool = False):
"""Minimalist header with version and mode."""
header_text = f"馃殌 Agentic Reliability Framework v{version} 路 "
header_text += "ENTERPRISE" if is_enterprise else "OSS Edition"
return gr.Markdown(header_text, elem_classes=["mono"])
def create_footer():
return gr.Markdown("ARF 漏 2025 路 Self-Healing Agentic Systems", elem_classes=["mono"])
# -----------------------------
# Tab 1: Incident Demo
# -----------------------------
def create_tab1_incident_demo(
scenarios: Dict[str, Any],
healing_intents: Optional[List[Dict[str, Any]]] = None
):
"""Minimalist Incident Demo tab (matches app.py signature)."""
with gr.Column():
scenario_dropdown = gr.Dropdown(
label="Scenario",
choices=list(scenarios.keys()),
value=list(scenarios.keys())[0],
)
execution_mode = gr.Radio(
label="Execution Mode",
choices=["advisory", "approval", "autonomous"],
value="advisory",
)
run_button = gr.Button("Run Analysis", variant="primary")
metrics_display = gr.Markdown("execution_state = idle", elem_classes=["mono"])
return scenario_dropdown, execution_mode, run_button, metrics_display
# -----------------------------
# Tab 2: Business ROI
# -----------------------------
def create_tab2_business_roi():
with gr.Column():
roi_markdown = gr.Markdown("## Business Impact & ROI\n```\nROI calculations will appear here\n```", elem_classes=["mono"])
return roi_markdown
# -----------------------------
# Tab 3: Enterprise Features
# -----------------------------
def create_tab3_enterprise_features():
with gr.Column():
features_markdown = gr.Markdown(
"## Enterprise Features\n- Full audit trail\n- Approval modes\n- Automated healing\n",
elem_classes=["mono"]
)
return features_markdown
# -----------------------------
# Tab 4: Audit Trail
# -----------------------------
def create_tab4_audit_trail():
with gr.Column():
audit_markdown = gr.Markdown("## Audit Trail & History\n```\nRecent actions will appear here\n```", elem_classes=["mono"])
return audit_markdown
# -----------------------------
# Tab 5: Learning Engine
# -----------------------------
def create_tab5_learning_engine():
with gr.Column():
learning_markdown = gr.Markdown("## Learning Engine Stats\n```\nModel improvements and patterns\n```", elem_classes=["mono"])
return learning_markdown