| """ |
| π ARF Ultimate Investor Demo v3.8.0 - ENTERPRISE EDITION |
| COMPLETE FIXED VERSION - All components integrated |
| """ |
|
|
| import logging |
| import sys |
| import traceback |
| import json |
| import datetime |
| import asyncio |
| import time |
| import numpy as np |
| from pathlib import Path |
| from typing import Dict, List, Any, Optional, Tuple |
|
|
| |
| logging.basicConfig( |
| level=logging.INFO, |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', |
| handlers=[ |
| logging.StreamHandler(sys.stdout), |
| logging.FileHandler('arf_demo.log') |
| ] |
| ) |
| logger = logging.getLogger(__name__) |
|
|
| |
| sys.path.insert(0, str(Path(__file__).parent)) |
|
|
| |
| try: |
| import plotly.graph_objects as go |
| import plotly.express as px |
| from plotly.subplots import make_subplots |
| PLOTLY_AVAILABLE = True |
| except ImportError: |
| logger.warning("Plotly not available - visualizations will be simplified") |
| PLOTLY_AVAILABLE = False |
|
|
| |
| |
| |
| try: |
| |
| from demo.scenarios import INCIDENT_SCENARIOS as SCENARIOS_DATA |
| |
| |
| from demo.orchestrator import DemoOrchestrator |
| |
| |
| from ui.components import ( |
| create_header, create_status_bar, create_tab1_incident_demo, |
| create_tab2_business_roi, create_tab3_audit_trail, |
| create_tab4_enterprise_features, create_tab5_learning_engine, |
| create_footer |
| ) |
| |
| logger.info("β
Successfully imported all modular components") |
| |
| except ImportError as e: |
| logger.error(f"Failed to import components: {e}") |
| logger.error(traceback.format_exc()) |
| |
| SCENARIOS_DATA = {} |
| DemoOrchestrator = None |
|
|
| |
| |
| |
| ENHANCED_SCENARIOS = { |
| "Cache Miss Storm": { |
| "description": "Redis cluster experiencing 80% cache miss rate causing database overload", |
| "severity": "CRITICAL", |
| "component": "redis_cache", |
| "metrics": { |
| "Cache Hit Rate": "18.5% (Critical)", |
| "Database Load": "92% (Overloaded)", |
| "Response Time": "1850ms (Slow)", |
| "Affected Users": "45,000", |
| "Eviction Rate": "125/sec" |
| }, |
| "impact": { |
| "Revenue Loss": "$8,500/hour", |
| "Page Load Time": "+300%", |
| "Users Impacted": "45,000", |
| "SLA Violation": "Yes", |
| "Customer Sat": "-40%" |
| }, |
| |
| "oss_results": { |
| "status": "β
OSS Analysis Complete", |
| "confidence": 0.87, |
| "similar_incidents": 3, |
| "rag_similarity_score": 0.72, |
| "recommendations": [ |
| "Scale Redis cache memory from 4GB β 8GB", |
| "Implement cache warming strategy", |
| "Optimize key patterns with TTL adjustments", |
| "Add circuit breaker for database fallback" |
| ], |
| "estimated_time": "60+ minutes manually", |
| "engineers_needed": "2-3 SREs + 1 DBA", |
| "advisory_only": True, |
| "healing_intent": { |
| "action": "scale_out", |
| "component": "redis_cache", |
| "parameters": {"scale_factor": 2.0}, |
| "confidence": 0.87, |
| "requires_enterprise": True |
| } |
| }, |
| |
| "enterprise_results": { |
| "execution_mode": "Autonomous", |
| "actions_executed": [ |
| "β
Auto-scaled Redis cluster: 4GB β 8GB", |
| "β
Deployed intelligent cache warming service", |
| "β
Optimized 12 key patterns with ML recommendations", |
| "β
Implemented circuit breaker with 95% success rate" |
| ], |
| "metrics_improvement": { |
| "Cache Hit Rate": "18.5% β 72%", |
| "Response Time": "1850ms β 450ms", |
| "Database Load": "92% β 45%", |
| "Throughput": "1250 β 2450 req/sec" |
| }, |
| "business_impact": { |
| "Recovery Time": "60 min β 12 min", |
| "Cost Saved": "$7,200", |
| "Users Impacted": "45,000 β 0", |
| "Revenue Protected": "$1,700", |
| "MTTR Improvement": "80% reduction" |
| }, |
| "audit_info": { |
| "execution_id": "exec_001", |
| "timestamp": datetime.datetime.now().isoformat(), |
| "approval_required": False, |
| "success": True |
| } |
| } |
| }, |
| |
| "Database Connection Pool Exhaustion": { |
| "description": "PostgreSQL connection pool exhausted causing API timeouts", |
| "severity": "HIGH", |
| "component": "postgresql_database", |
| "metrics": { |
| "Active Connections": "98/100 (Critical)", |
| "API Latency": "2450ms", |
| "Error Rate": "15.2%", |
| "Queue Depth": "1250", |
| "Connection Wait": "45s" |
| }, |
| "impact": { |
| "Revenue Loss": "$4,200/hour", |
| "Affected Services": "API Gateway, User Service, Payment", |
| "SLA Violation": "Yes", |
| "Partner Impact": "3 external APIs" |
| }, |
| "oss_results": { |
| "status": "β
OSS Analysis Complete", |
| "confidence": 0.82, |
| "similar_incidents": 2, |
| "rag_similarity_score": 0.65, |
| "recommendations": [ |
| "Increase connection pool size from 100 β 200", |
| "Implement connection pooling monitoring", |
| "Add query timeout enforcement", |
| "Deploy read replica for read-heavy queries" |
| ], |
| "estimated_time": "45+ minutes manually", |
| "engineers_needed": "1 DBA + 1 Backend Engineer", |
| "advisory_only": True, |
| "healing_intent": { |
| "action": "scale_connection_pool", |
| "component": "postgresql_database", |
| "parameters": {"max_connections": 200}, |
| "confidence": 0.82, |
| "requires_enterprise": True |
| } |
| }, |
| "enterprise_results": { |
| "execution_mode": "Approval Required", |
| "actions_executed": [ |
| "β
Increased connection pool: 100 β 200 connections", |
| "β
Deployed real-time connection monitoring", |
| "β
Implemented query timeout: 30s β 10s", |
| "β
Automated read replica traffic routing" |
| ], |
| "metrics_improvement": { |
| "API Latency": "2450ms β 320ms", |
| "Error Rate": "15.2% β 0.8%", |
| "Connection Wait": "45s β 120ms", |
| "Throughput": "850 β 2100 req/sec" |
| }, |
| "business_impact": { |
| "Recovery Time": "45 min β 8 min", |
| "Cost Saved": "$3,150", |
| "Failed Transactions": "12,500 β 0", |
| "SLA Compliance": "Restored to 99.9%" |
| }, |
| "audit_info": { |
| "execution_id": "exec_002", |
| "timestamp": datetime.datetime.now().isoformat(), |
| "approval_required": True, |
| "success": True |
| } |
| } |
| }, |
| |
| "Kubernetes Memory Leak": { |
| "description": "Java microservice memory leak causing pod restarts", |
| "severity": "HIGH", |
| "component": "java_payment_service", |
| "metrics": { |
| "Memory Usage": "96% (Critical)", |
| "GC Pause Time": "4500ms", |
| "Error Rate": "28.5%", |
| "Pod Restarts": "12/hour", |
| "Heap Fragmentation": "42%" |
| }, |
| "impact": { |
| "Revenue Loss": "$5,500/hour", |
| "Session Loss": "8,500 users", |
| "Payment Failures": "3.2% of transactions", |
| "Support Tickets": "+300%" |
| }, |
| "oss_results": { |
| "status": "β
OSS Analysis Complete", |
| "confidence": 0.79, |
| "similar_incidents": 4, |
| "rag_similarity_score": 0.68, |
| "recommendations": [ |
| "Increase pod memory limits from 2GB β 4GB", |
| "Implement memory leak detection", |
| "Deploy canary with fixed version", |
| "Add circuit breaker for graceful degradation" |
| ], |
| "estimated_time": "90+ minutes manually", |
| "engineers_needed": "2 Java Devs + 1 SRE", |
| "advisory_only": True, |
| "healing_intent": { |
| "action": "scale_memory", |
| "component": "java_payment_service", |
| "parameters": {"memory_limit_gb": 4}, |
| "confidence": 0.79, |
| "requires_enterprise": True |
| } |
| }, |
| "enterprise_results": { |
| "execution_mode": "Autonomous with Rollback", |
| "actions_executed": [ |
| "β
Scaled pod memory: 2GB β 4GB with monitoring", |
| "β
Deployed memory leak detection service", |
| "β
Rolled out canary with memory fixes", |
| "β
Implemented auto-rollback on failure" |
| ], |
| "metrics_improvement": { |
| "Memory Usage": "96% β 68%", |
| "GC Pause Time": "4500ms β 320ms", |
| "Error Rate": "28.5% β 1.2%", |
| "Pod Stability": "12/hour β 0 restarts" |
| }, |
| "business_impact": { |
| "Recovery Time": "90 min β 15 min", |
| "Cost Saved": "$4,950", |
| "Transaction Success": "96.8% β 99.9%", |
| "User Impact": "8,500 β 0 affected" |
| }, |
| "audit_info": { |
| "execution_id": "exec_003", |
| "timestamp": datetime.datetime.now().isoformat(), |
| "approval_required": False, |
| "success": True |
| } |
| } |
| }, |
| |
| "API Rate Limit Storm": { |
| "description": "Third-party API rate limiting causing cascading failures", |
| "severity": "MEDIUM", |
| "component": "external_api_gateway", |
| "metrics": { |
| "Rate Limit Hits": "95% of requests", |
| "Error Rate": "42.8%", |
| "Retry Storm": "Active", |
| "Cascade Effect": "3 dependent services", |
| "Queue Backlog": "8,500 requests" |
| }, |
| "impact": { |
| "Revenue Loss": "$3,800/hour", |
| "Partner SLA Breach": "Yes", |
| "Data Sync Delay": "4+ hours", |
| "Customer Reports": "Delayed by 6 hours" |
| }, |
| "oss_results": { |
| "status": "β
OSS Analysis Complete", |
| "confidence": 0.85, |
| "similar_incidents": 3, |
| "rag_similarity_score": 0.71, |
| "recommendations": [ |
| "Implement exponential backoff with jitter", |
| "Deploy circuit breaker pattern", |
| "Add request queuing with prioritization", |
| "Implement adaptive rate limiting" |
| ], |
| "estimated_time": "75+ minutes manually", |
| "engineers_needed": "2 Backend Engineers + 1 DevOps", |
| "advisory_only": True, |
| "healing_intent": { |
| "action": "implement_rate_limiting", |
| "component": "external_api_gateway", |
| "parameters": {"backoff_strategy": "exponential"}, |
| "confidence": 0.85, |
| "requires_enterprise": True |
| } |
| }, |
| "enterprise_results": { |
| "execution_mode": "Autonomous", |
| "actions_executed": [ |
| "β
Implemented exponential backoff: 1s β 32s with jitter", |
| "β
Deployed circuit breaker with 80% success threshold", |
| "β
Added intelligent request queuing", |
| "β
Enabled adaptive rate limiting based on API health" |
| ], |
| "metrics_improvement": { |
| "Rate Limit Hits": "95% β 12%", |
| "Error Rate": "42.8% β 3.5%", |
| "Successful Retries": "18% β 89%", |
| "Queue Processing": "8,500 β 0 backlog" |
| }, |
| "business_impact": { |
| "Recovery Time": "75 min β 10 min", |
| "Cost Saved": "$3,420", |
| "SLA Compliance": "Restored within 5 minutes", |
| "Data Freshness": "4+ hours β <5 minute delay" |
| }, |
| "audit_info": { |
| "execution_id": "exec_004", |
| "timestamp": datetime.datetime.now().isoformat(), |
| "approval_required": False, |
| "success": True |
| } |
| } |
| } |
| } |
|
|
| |
| |
| |
| class SimpleVizEngine: |
| """Simple visualization engine that works without complex imports""" |
| |
| @staticmethod |
| def create_timeline_plot(scenario_name="Incident"): |
| """Create a simple timeline plot""" |
| if not PLOTLY_AVAILABLE: |
| |
| import matplotlib.pyplot as plt |
| import io |
| import base64 |
| |
| fig, ax = plt.subplots(figsize=(10, 4)) |
| events = ['Detection', 'Analysis', 'Action', 'Recovery'] |
| times = [0, 1, 2, 3] |
| |
| ax.plot(times, [1, 1, 1, 1], 'bo-', markersize=10) |
| for i, (event, t) in enumerate(zip(events, times)): |
| ax.text(t, 1.1, event, ha='center', fontsize=10) |
| |
| ax.set_ylim(0.5, 1.5) |
| ax.set_xlim(-0.5, 3.5) |
| ax.set_title(f'Timeline: {scenario_name}') |
| ax.axis('off') |
| |
| buf = io.BytesIO() |
| plt.savefig(buf, format='png', bbox_inches='tight') |
| plt.close(fig) |
| buf.seek(0) |
| |
| return f"data:image/png;base64,{base64.b64encode(buf.read()).decode()}" |
| |
| |
| fig = go.Figure() |
| |
| events = [ |
| {"time": "T-5m", "event": "Detection", "type": "detection"}, |
| {"time": "T-3m", "event": "OSS Analysis", "type": "analysis"}, |
| {"time": "T-2m", "event": "Enterprise Action", "type": "action"}, |
| {"time": "T-0m", "event": "Recovery", "type": "recovery"} |
| ] |
| |
| for event in events: |
| fig.add_trace(go.Scatter( |
| x=[event["time"]], |
| y=[1], |
| mode='markers+text', |
| marker=dict(size=20, color='#4ECDC4'), |
| text=[event["event"]], |
| textposition="top center" |
| )) |
| |
| fig.update_layout( |
| title=f"Timeline: {scenario_name}", |
| height=300, |
| showlegend=False, |
| yaxis=dict(showticklabels=False, range=[0.5, 1.5]), |
| margin=dict(l=20, r=20, t=40, b=20) |
| ) |
| |
| return fig |
| |
| @staticmethod |
| def create_dashboard_plot(): |
| """Create simple dashboard plot""" |
| if not PLOTLY_AVAILABLE: |
| return None |
| |
| fig = make_subplots(rows=1, cols=2, subplot_titles=('Cost Savings', 'MTTR Improvement')) |
| |
| |
| fig.add_trace( |
| go.Bar(x=['Without ARF', 'With ARF'], y=[100, 25], name='Cost'), |
| row=1, col=1 |
| ) |
| |
| |
| fig.add_trace( |
| go.Bar(x=['Manual', 'ARF OSS', 'ARF Enterprise'], y=[120, 25, 8], name='MTTR'), |
| row=1, col=2 |
| ) |
| |
| fig.update_layout(height=400, showlegend=False) |
| return fig |
|
|
| |
| |
| |
| class AuditTrailManager: |
| def __init__(self): |
| self.executions = [] |
| self.incidents = [] |
| |
| def add_execution(self, scenario_name, mode, success=True, savings=0): |
| entry = { |
| "id": f"exec_{len(self.executions):03d}", |
| "time": datetime.datetime.now().strftime("%H:%M"), |
| "scenario": scenario_name, |
| "mode": mode, |
| "status": "β
Success" if success else "β Failed", |
| "savings": f"${savings:,}", |
| "details": f"{mode} execution" |
| } |
| self.executions.insert(0, entry) |
| return entry |
| |
| def add_incident(self, scenario_name, severity="HIGH"): |
| entry = { |
| "id": f"inc_{len(self.incidents):03d}", |
| "time": datetime.datetime.now().strftime("%H:%M"), |
| "scenario": scenario_name, |
| "severity": severity, |
| "component": ENHANCED_SCENARIOS.get(scenario_name, {}).get("component", "unknown"), |
| "status": "Analyzed" |
| } |
| self.incidents.insert(0, entry) |
| return entry |
| |
| def get_execution_table(self): |
| return [ |
| [e["time"], e["scenario"], e["mode"], e["status"], e["savings"], e["details"]] |
| for e in self.executions[:10] |
| ] |
| |
| def get_incident_table(self): |
| return [ |
| [e["time"], e["component"], e["scenario"], e["severity"], e["status"]] |
| for e in self.incidents[:15] |
| ] |
|
|
| |
| |
| |
| def create_demo_interface(): |
| """Create the demo interface with all fixes applied""" |
| |
| import gradio as gr |
| |
| |
| viz_engine = SimpleVizEngine() |
| audit_manager = AuditTrailManager() |
| |
| |
| orchestrator = None |
| if DemoOrchestrator: |
| try: |
| orchestrator = DemoOrchestrator() |
| except: |
| pass |
| |
| |
| custom_css = """ |
| .oss-section { |
| background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important; |
| border-left: 4px solid #2196f3 !important; |
| padding: 15px !important; |
| border-radius: 8px !important; |
| margin-bottom: 15px !important; |
| } |
| .enterprise-section { |
| background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%) !important; |
| border-left: 4px solid #4caf50 !important; |
| padding: 15px !important; |
| border-radius: 8px !important; |
| margin-bottom: 15px !important; |
| } |
| .critical { color: #d32f2f !important; font-weight: bold; } |
| .success { color: #388e3c !important; font-weight: bold; } |
| """ |
| |
| with gr.Blocks(title="π ARF Investor Demo v3.8.0", css=custom_css) as demo: |
| |
| |
| create_header("3.3.6", False) |
| |
| |
| create_status_bar() |
| |
| |
| with gr.Tabs(): |
| |
| |
| with gr.TabItem("π₯ Live Incident Demo"): |
| |
| (scenario_dropdown, scenario_description, metrics_display, impact_display, |
| timeline_output, oss_btn, enterprise_btn, approval_toggle, demo_btn, |
| approval_display, config_display, results_display) = create_tab1_incident_demo( |
| ENHANCED_SCENARIOS, "Cache Miss Storm" |
| ) |
| |
| |
| with gr.Row(): |
| with gr.Column(): |
| gr.Markdown("### π OSS Analysis Results (Advisory Only)") |
| oss_results = gr.JSON( |
| value={}, |
| label="" |
| ) |
| |
| with gr.Column(): |
| gr.Markdown("### π― Enterprise Execution Results") |
| enterprise_results = gr.JSON( |
| value={}, |
| label="" |
| ) |
| |
| |
| with gr.TabItem("π° Business Impact & ROI"): |
| (dashboard_output, monthly_slider, impact_slider, team_slider, |
| calculate_btn, roi_output) = create_tab2_business_roi() |
| |
| |
| with gr.TabItem("π Audit Trail & History"): |
| (refresh_btn, clear_btn, export_btn, execution_table, savings_chart, |
| incident_table, memory_graph, export_text) = create_tab3_audit_trail() |
| |
| |
| with gr.TabItem("π’ Enterprise Features"): |
| create_tab4_enterprise_features() |
| |
| with gr.TabItem("π§ Learning Engine"): |
| create_tab5_learning_engine() |
| |
| |
| create_footer() |
| |
| |
| |
| |
| def update_scenario(scenario_name): |
| scenario = ENHANCED_SCENARIOS.get(scenario_name, {}) |
| |
| |
| if PLOTLY_AVAILABLE: |
| timeline = viz_engine.create_timeline_plot(scenario_name) |
| else: |
| timeline = None |
| |
| return ( |
| f"### {scenario_name}\n{scenario.get('description', 'No description')}", |
| scenario.get("metrics", {}), |
| scenario.get("impact", {}), |
| timeline if timeline else gr.Plot(visible=False), |
| {}, |
| {} |
| ) |
| |
| scenario_dropdown.change( |
| fn=update_scenario, |
| inputs=[scenario_dropdown], |
| outputs=[scenario_description, metrics_display, impact_display, |
| timeline_output, oss_results, enterprise_results] |
| ) |
| |
| |
| async def run_oss_analysis(scenario_name): |
| scenario = ENHANCED_SCENARIOS.get(scenario_name, {}) |
| |
| |
| audit_manager.add_incident(scenario_name, scenario.get("severity", "HIGH")) |
| |
| |
| oss_result = scenario.get("oss_results", {}) |
| |
| |
| incident_table_data = audit_manager.get_incident_table() |
| |
| return oss_result, incident_table_data |
| |
| oss_btn.click( |
| fn=run_oss_analysis, |
| inputs=[scenario_dropdown], |
| outputs=[oss_results, incident_table] |
| ) |
| |
| |
| def execute_enterprise_healing(scenario_name, approval_required): |
| scenario = ENHANCED_SCENARIOS.get(scenario_name, {}) |
| |
| |
| enterprise_result = scenario.get("enterprise_results", {}) |
| |
| |
| mode = "Approval" if approval_required else "Autonomous" |
| |
| |
| impact = scenario.get("impact", {}) |
| revenue_loss = impact.get("Revenue Loss", "$0") |
| try: |
| savings = int(revenue_loss.replace("$", "").replace(",", "").split("/")[0]) * 0.85 |
| except: |
| savings = 5000 |
| |
| |
| audit_manager.add_execution( |
| scenario_name, |
| mode, |
| savings=int(savings) |
| ) |
| |
| |
| if approval_required: |
| approval_html = f""" |
| <div class='enterprise-section'> |
| <h4>β
Approved & Executed</h4> |
| <p>Action for <strong>{scenario_name}</strong> was approved by system administrator and executed successfully.</p> |
| <p><strong>Mode:</strong> Manual Approval</p> |
| <p><strong>Cost Saved:</strong> ${int(savings):,}</p> |
| </div> |
| """ |
| else: |
| approval_html = f""" |
| <div class='enterprise-section'> |
| <h4>β‘ Auto-Executed</h4> |
| <p>Action for <strong>{scenario_name}</strong> was executed autonomously by ARF Enterprise.</p> |
| <p><strong>Mode:</strong> Fully Autonomous</p> |
| <p><strong>Cost Saved:</strong> ${int(savings):,}</p> |
| </div> |
| """ |
| |
| |
| execution_table_data = audit_manager.get_execution_table() |
| |
| return approval_html, enterprise_result, execution_table_data |
| |
| enterprise_btn.click( |
| fn=execute_enterprise_healing, |
| inputs=[scenario_dropdown, approval_toggle], |
| outputs=[approval_display, enterprise_results, execution_table] |
| ) |
| |
| |
| async def run_quick_demo(): |
| |
| scenario = ENHANCED_SCENARIOS["Cache Miss Storm"] |
| oss_result = scenario.get("oss_results", {}) |
| |
| |
| enterprise_result = scenario.get("enterprise_results", {}) |
| |
| |
| audit_manager.add_incident("Cache Miss Storm", "CRITICAL") |
| audit_manager.add_execution("Cache Miss Storm", "Autonomous", savings=7200) |
| |
| |
| execution_table_data = audit_manager.get_execution_table() |
| incident_table_data = audit_manager.get_incident_table() |
| |
| |
| approval_html = """ |
| <div class='enterprise-section'> |
| <h4>β‘ Quick Demo Completed</h4> |
| <p>Full OSS analysis β Enterprise execution completed successfully.</p> |
| <p><strong>Mode:</strong> Autonomous</p> |
| <p><strong>Cost Saved:</strong> $7,200</p> |
| </div> |
| """ |
| |
| return ( |
| oss_result, |
| approval_html, |
| enterprise_result, |
| execution_table_data, |
| incident_table_data, |
| gr.Checkbox.update(value=False) |
| ) |
| |
| demo_btn.click( |
| fn=run_quick_demo, |
| outputs=[ |
| oss_results, |
| approval_display, |
| enterprise_results, |
| execution_table, |
| incident_table, |
| approval_toggle |
| ] |
| ) |
| |
| |
| def calculate_roi(monthly, impact, team): |
| if orchestrator: |
| company_data = { |
| "monthly_incidents": monthly, |
| "avg_cost_per_incident": impact, |
| "team_size": team |
| } |
| roi_result = orchestrator.calculate_roi(company_data) |
| else: |
| |
| annual = monthly * 12 * impact |
| savings = annual * 0.82 |
| team_cost = team * 150000 |
| roi_multiplier = savings / team_cost if team_cost > 0 else 0 |
| |
| roi_result = { |
| "annual_impact": annual, |
| "team_cost": team_cost, |
| "potential_savings": savings, |
| "roi_multiplier": roi_multiplier, |
| "payback_months": (team_cost / (savings / 12)) if savings > 0 else 0 |
| } |
| |
| |
| formatted = { |
| "Annual Impact": f"${roi_result.get('annual_impact', 0):,.0f}", |
| "Team Cost": f"${roi_result.get('team_cost', 0):,.0f}", |
| "Potential Savings": f"${roi_result.get('potential_savings', 0):,.0f}", |
| "ROI Multiplier": f"{roi_result.get('roi_multiplier', 0):.1f}Γ", |
| "Payback Period": f"{roi_result.get('payback_months', 0):.1f} months" |
| } |
| |
| |
| dashboard = viz_engine.create_dashboard_plot() |
| |
| return formatted, dashboard |
| |
| calculate_btn.click( |
| fn=calculate_roi, |
| inputs=[monthly_slider, impact_slider, team_slider], |
| outputs=[roi_output, dashboard_output] |
| ) |
| |
| |
| def refresh_audit_trail(): |
| return audit_manager.get_execution_table(), audit_manager.get_incident_table() |
| |
| refresh_btn.click( |
| fn=refresh_audit_trail, |
| outputs=[execution_table, incident_table] |
| ) |
| |
| |
| def clear_audit_trail(): |
| audit_manager.executions = [] |
| audit_manager.incidents = [] |
| return audit_manager.get_execution_table(), audit_manager.get_incident_table() |
| |
| clear_btn.click( |
| fn=clear_audit_trail, |
| outputs=[execution_table, incident_table] |
| ) |
| |
| |
| demo.load( |
| fn=lambda: update_scenario("Cache Miss Storm"), |
| outputs=[scenario_description, metrics_display, impact_display, |
| timeline_output, oss_results, enterprise_results] |
| ) |
| |
| return demo |
|
|
| |
| |
| |
| def main(): |
| """Main entry point""" |
| print("π Starting ARF Ultimate Investor Demo v3.8.0...") |
| print("=" * 70) |
| print("π Features:") |
| print(" β’ 4 Enhanced Incident Scenarios") |
| print(" β’ Clear OSS vs Enterprise Separation") |
| print(" β’ Fixed Visualization Engine") |
| print(" β’ Working Event Handlers") |
| print("=" * 70) |
| print("π Opening web interface...") |
| |
| demo = create_demo_interface() |
| demo.launch( |
| server_name="0.0.0.0", |
| server_port=7860, |
| share=False |
| ) |
|
|
| if __name__ == "__main__": |
| main() |