petter2025 commited on
Commit
7f3d172
Β·
verified Β·
1 Parent(s): 186b52e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +246 -699
app.py CHANGED
@@ -1,678 +1,224 @@
1
  """
2
- πŸš€ ARF ULTIMATE INVESTOR DEMO v3.5.0 - FULLY WORKING VERSION
3
- All buttons working, all visualizations rendering, no errors
4
  """
5
 
6
- import datetime
7
- import json
8
  import logging
9
- import uuid
10
- import random
11
- from typing import Dict, Any, List
12
  import gradio as gr
13
- import plotly.graph_objects as go
14
- import plotly.express as px
15
- import pandas as pd
16
- from plotly.subplots import make_subplots
 
 
 
 
 
 
 
 
 
17
 
18
  # Configure logging
19
  logging.basicConfig(level=logging.INFO)
20
  logger = logging.getLogger(__name__)
21
 
22
  # ===========================================
23
- # INCIDENT DATA STORAGE
24
  # ===========================================
25
 
26
- INCIDENT_SCENARIOS = {
27
- "Cache Miss Storm": {
28
- "metrics": {
29
- "Cache Hit Rate": "18.5% (Critical)",
30
- "Database Load": "92% (Overloaded)",
31
- "Response Time": "1850ms (Slow)",
32
- "Affected Users": "45,000"
33
- },
34
- "impact": {
35
- "Revenue Loss": "$8,500/hour",
36
- "Page Load Time": "+300%",
37
- "Users Impacted": "45,000"
38
- },
39
- "oss_analysis": {
40
- "status": "βœ… Analysis Complete",
41
- "recommendations": [
42
- "Increase Redis cache memory allocation",
43
- "Implement cache warming strategy",
44
- "Optimize key patterns (TTL adjustments)",
45
- "Add circuit breaker for database fallback"
46
- ],
47
- "estimated_time": "60+ minutes",
48
- "engineers_needed": "2-3 SREs",
49
- "manual_effort": "High"
50
- },
51
- "enterprise_results": {
52
- "actions_completed": [
53
- "βœ… Auto-scaled Redis: 4GB β†’ 8GB",
54
- "βœ… Deployed cache warming service",
55
- "βœ… Optimized 12 key patterns",
56
- "βœ… Implemented circuit breaker"
57
- ],
58
- "metrics_improvement": {
59
- "Cache Hit Rate": "18.5% β†’ 72%",
60
- "Response Time": "1850ms β†’ 450ms",
61
- "Database Load": "92% β†’ 45%"
62
- },
63
- "business_impact": {
64
- "Recovery Time": "60 min β†’ 12 min",
65
- "Cost Saved": "$7,200",
66
- "Users Impacted": "45,000 β†’ 0"
67
- }
68
- }
69
- },
70
- "Database Connection Pool Exhaustion": {
71
- "metrics": {
72
- "Active Connections": "98/100 (Critical)",
73
- "API Latency": "2450ms",
74
- "Error Rate": "15.2%",
75
- "Queue Depth": "1250"
76
- },
77
- "impact": {
78
- "Revenue Loss": "$4,200/hour",
79
- "Affected Services": "API Gateway, User Service",
80
- "SLA Violation": "Yes"
81
- },
82
- "oss_analysis": {
83
- "status": "βœ… Analysis Complete",
84
- "recommendations": [
85
- "Increase connection pool from 100 to 200",
86
- "Add connection timeout (30s)",
87
- "Implement leak detection",
88
- "Add connection health checks"
89
- ],
90
- "estimated_time": "45+ minutes",
91
- "engineers_needed": "1-2 DBAs",
92
- "manual_effort": "Medium-High"
93
- }
94
- },
95
- "Memory Leak in Production": {
96
- "metrics": {
97
- "Memory Usage": "96% (Critical)",
98
- "GC Pause Time": "4500ms",
99
- "Error Rate": "28.5%",
100
- "Restart Frequency": "12/hour"
101
- },
102
- "impact": {
103
- "Revenue Loss": "$5,500/hour",
104
- "Session Loss": "8,500 users",
105
- "Customer Impact": "High"
106
- }
107
- }
108
- }
109
-
110
- # ===========================================
111
- # VISUALIZATION ENGINE
112
- # ===========================================
113
-
114
- class VisualizationEngine:
115
- """Working visualization engine with no errors"""
116
 
117
- @staticmethod
118
- def create_timeline_visualization():
119
- """Create interactive incident timeline"""
120
- try:
121
- # Create sample timeline data
122
- now = datetime.datetime.now()
123
- events = [
124
- {"time": now - datetime.timedelta(minutes=25), "event": "πŸ“‰ Cache Hit Rate drops to 18.5%", "type": "problem"},
125
- {"time": now - datetime.timedelta(minutes=22), "event": "⚠️ Alert: Database load hits 92%", "type": "alert"},
126
- {"time": now - datetime.timedelta(minutes=20), "event": "πŸ€– ARF detects pattern", "type": "detection"},
127
- {"time": now - datetime.timedelta(minutes=18), "event": "🧠 Analysis: Cache Miss Storm identified", "type": "analysis"},
128
- {"time": now - datetime.timedelta(minutes=15), "event": "⚑ Enterprise healing executed", "type": "action"},
129
- {"time": now - datetime.timedelta(minutes=12), "event": "βœ… Cache Hit Rate recovers to 72%", "type": "recovery"},
130
- {"time": now - datetime.timedelta(minutes=10), "event": "πŸ“Š System stabilized", "type": "stable"}
131
- ]
132
-
133
- df = pd.DataFrame(events)
134
- df['time_str'] = df['time'].dt.strftime('%H:%M:%S')
135
-
136
- # Color mapping
137
- color_map = {
138
- "problem": "red",
139
- "alert": "orange",
140
- "detection": "blue",
141
- "analysis": "purple",
142
- "action": "green",
143
- "recovery": "lightgreen",
144
- "stable": "darkgreen"
145
- }
146
-
147
- fig = go.Figure()
148
-
149
- for event_type in df['type'].unique():
150
- type_df = df[df['type'] == event_type]
151
- fig.add_trace(go.Scatter(
152
- x=type_df['time'],
153
- y=[event_type] * len(type_df),
154
- mode='markers+text',
155
- name=event_type.capitalize(),
156
- marker=dict(
157
- size=15,
158
- color=color_map.get(event_type, 'gray'),
159
- symbol='circle' if event_type in ['problem', 'alert'] else 'diamond',
160
- line=dict(width=2, color='white')
161
- ),
162
- text=type_df['event'],
163
- textposition="top center",
164
- hoverinfo='text'
165
- ))
166
-
167
- fig.update_layout(
168
- title="<b>Incident Timeline - Cache Miss Storm Resolution</b>",
169
- xaxis_title="Time β†’",
170
- yaxis_title="Event Type",
171
- height=500,
172
- showlegend=True,
173
- paper_bgcolor='rgba(0,0,0,0)',
174
- plot_bgcolor='rgba(0,0,0,0)',
175
- hovermode='closest',
176
- xaxis=dict(
177
- tickformat='%H:%M',
178
- gridcolor='rgba(200,200,200,0.2)'
179
- ),
180
- yaxis=dict(
181
- gridcolor='rgba(200,200,200,0.1)'
182
- )
183
- )
184
-
185
- return fig
186
- except Exception as e:
187
- logger.error(f"Error creating timeline: {e}")
188
- return VisualizationEngine._create_error_figure("Timeline")
189
-
190
- @staticmethod
191
- def create_business_dashboard():
192
- """Create business health dashboard"""
193
- try:
194
- fig = make_subplots(
195
- rows=2, cols=2,
196
- subplot_titles=('Annual Cost Impact', 'Team Time Reclaimed',
197
- 'MTTR Comparison', 'ROI Analysis'),
198
- vertical_spacing=0.15,
199
- horizontal_spacing=0.15
200
- )
201
-
202
- # 1. Cost Impact
203
- categories = ['Without ARF', 'With ARF Enterprise', 'Net Savings']
204
- values = [2960000, 1000000, 1960000]
205
-
206
- fig.add_trace(
207
- go.Bar(
208
- x=categories,
209
- y=values,
210
- marker_color=['#FF6B6B', '#4ECDC4', '#45B7D1'],
211
- text=[f'${v/1000000:.1f}M' for v in values],
212
- textposition='auto',
213
- name='Cost Impact'
214
- ),
215
- row=1, col=1
216
- )
217
-
218
- # 2. Time Allocation
219
- labels = ['Firefighting', 'Innovation', 'Maintenance']
220
- before = [60, 20, 20]
221
- after = [10, 60, 30]
222
-
223
- fig.add_trace(
224
- go.Bar(
225
- x=labels,
226
- y=before,
227
- name='Before ARF',
228
- marker_color='#FF6B6B'
229
- ),
230
- row=1, col=2
231
- )
232
-
233
- fig.add_trace(
234
- go.Bar(
235
- x=labels,
236
- y=after,
237
- name='After ARF Enterprise',
238
- marker_color='#4ECDC4'
239
- ),
240
- row=1, col=2
241
- )
242
-
243
- # 3. MTTR Comparison
244
- mttr_categories = ['Traditional', 'ARF OSS', 'ARF Enterprise']
245
- mttr_values = [45, 25, 8]
246
-
247
- fig.add_trace(
248
- go.Bar(
249
- x=mttr_categories,
250
- y=mttr_values,
251
- marker_color=['#FF6B6B', '#FFE66D', '#4ECDC4'],
252
- text=[f'{v} min' for v in mttr_values],
253
- textposition='auto',
254
- name='MTTR'
255
- ),
256
- row=2, col=1
257
- )
258
-
259
- # 4. ROI Gauge
260
- fig.add_trace(
261
- go.Indicator(
262
- mode="gauge+number+delta",
263
- value=5.2,
264
- title={'text': "ROI Multiplier"},
265
- delta={'reference': 1.0, 'increasing': {'color': "green"}},
266
- gauge={
267
- 'axis': {'range': [0, 10], 'tickwidth': 1},
268
- 'bar': {'color': "#4ECDC4"},
269
- 'steps': [
270
- {'range': [0, 2], 'color': "lightgray"},
271
- {'range': [2, 4], 'color': "gray"},
272
- {'range': [4, 6], 'color': "lightgreen"},
273
- {'range': [6, 10], 'color': "green"}
274
- ],
275
- 'threshold': {
276
- 'line': {'color': "red", 'width': 4},
277
- 'thickness': 0.75,
278
- 'value': 5.2
279
- }
280
- }
281
- ),
282
- row=2, col=2
283
- )
284
-
285
- fig.update_layout(
286
- height=700,
287
- showlegend=True,
288
- paper_bgcolor='rgba(0,0,0,0)',
289
- plot_bgcolor='rgba(0,0,0,0)',
290
- title_text="<b>Executive Business Health Dashboard</b>",
291
- barmode='group'
292
- )
293
-
294
- # Update axes
295
- fig.update_xaxes(title_text="Cost Categories", row=1, col=1)
296
- fig.update_yaxes(title_text="Annual Cost ($)", row=1, col=1)
297
-
298
- fig.update_xaxes(title_text="Activity Type", row=1, col=2)
299
- fig.update_yaxes(title_text="Percentage (%)", row=1, col=2)
300
-
301
- fig.update_xaxes(title_text="Solution Type", row=2, col=1)
302
- fig.update_yaxes(title_text="Minutes to Resolve", row=2, col=1)
303
-
304
- return fig
305
- except Exception as e:
306
- logger.error(f"Error creating dashboard: {e}")
307
- return VisualizationEngine._create_error_figure("Dashboard")
308
-
309
- @staticmethod
310
- def create_metrics_stream():
311
- """Create metrics stream visualization"""
312
- try:
313
- # Generate time series data
314
- times = pd.date_range(end=datetime.datetime.now(), periods=50, freq='1min')
315
-
316
- fig = go.Figure()
317
-
318
- # Cache Hit Rate
319
- fig.add_trace(go.Scatter(
320
- x=times,
321
- y=[18.5 + i * 1.2 for i in range(50)], # Recovery trend
322
- mode='lines',
323
- name='Cache Hit Rate',
324
- line=dict(color='blue', width=2),
325
- yaxis='y1'
326
- ))
327
-
328
- # Database Load
329
- fig.add_trace(go.Scatter(
330
- x=times,
331
- y=[92 - i * 0.94 for i in range(50)], # Decreasing trend
332
- mode='lines',
333
- name='Database Load',
334
- line=dict(color='red', width=2),
335
- yaxis='y2'
336
- ))
337
-
338
- fig.update_layout(
339
- title="<b>Real-time Metrics Recovery</b>",
340
- xaxis_title="Time",
341
- height=500,
342
- paper_bgcolor='rgba(0,0,0,0)',
343
- plot_bgcolor='rgba(0,0,0,0)',
344
- yaxis=dict(
345
- title="Cache Hit Rate (%)",
346
- side='left',
347
- range=[0, 100]
348
- ),
349
- yaxis2=dict(
350
- title="Database Load (%)",
351
- side='right',
352
- overlaying='y',
353
- range=[0, 100]
354
- ),
355
- legend=dict(
356
- yanchor="top",
357
- y=0.99,
358
- xanchor="left",
359
- x=0.01
360
- )
361
- )
362
-
363
- return fig
364
- except Exception as e:
365
- logger.error(f"Error creating stream: {e}")
366
- return VisualizationEngine._create_error_figure("Metrics Stream")
367
-
368
- @staticmethod
369
- def create_performance_radar():
370
- """Create performance radar chart"""
371
- try:
372
- categories = ['Reliability', 'Speed', 'Cost Savings', 'Auto-Heal Rate', 'ROI']
373
- values = [95, 88, 92, 82, 85]
374
-
375
- fig = go.Figure(data=go.Scatterpolar(
376
- r=values + [values[0]],
377
- theta=categories + [categories[0]],
378
- fill='toself',
379
- fillcolor='rgba(52, 152, 219, 0.3)',
380
- line=dict(color='rgba(52, 152, 219, 0.8)', width=2),
381
- name="ARF Enterprise"
382
- ))
383
-
384
- fig.update_layout(
385
- polar=dict(
386
- radialaxis=dict(
387
- visible=True,
388
- range=[0, 100],
389
- gridcolor='rgba(200, 200, 200, 0.3)'
390
- )),
391
- showlegend=True,
392
- paper_bgcolor='rgba(0,0,0,0)',
393
- plot_bgcolor='rgba(0,0,0,0)',
394
- height=500,
395
- title="<b>Performance Radar - ARF Enterprise</b>"
396
- )
397
-
398
- return fig
399
- except Exception as e:
400
- logger.error(f"Error creating radar: {e}")
401
- return VisualizationEngine._create_error_figure("Radar Chart")
402
-
403
- @staticmethod
404
- def create_execution_history():
405
- """Create execution history chart"""
406
- try:
407
- executions = [
408
- {"time": "22:14", "scenario": "Cache Miss Storm", "savings": 7200},
409
- {"time": "21:58", "scenario": "Memory Leak", "savings": 5200},
410
- {"time": "21:45", "scenario": "API Rate Limit", "savings": 2800},
411
- {"time": "21:30", "scenario": "DB Pool Exhaustion", "savings": 3800},
412
- {"time": "21:15", "scenario": "Cache Miss Storm", "savings": 7200},
413
- {"time": "21:00", "scenario": "Cascading Failure", "savings": 12500}
414
- ]
415
-
416
- df = pd.DataFrame(executions)
417
-
418
- fig = go.Figure(data=[
419
- go.Bar(
420
- x=df['scenario'],
421
- y=df['savings'],
422
- marker_color='#4ECDC4',
423
- text=[f'${s:,.0f}' for s in df['savings']],
424
- textposition='outside',
425
- name='Cost Saved'
426
- )
427
- ])
428
-
429
- fig.update_layout(
430
- title="<b>Execution History - Cost Savings</b>",
431
- xaxis_title="Incident Scenario",
432
- yaxis_title="Cost Saved ($)",
433
- height=500,
434
- paper_bgcolor='rgba(0,0,0,0)',
435
- plot_bgcolor='rgba(0,0,0,0)',
436
- showlegend=False
437
- )
438
-
439
- return fig
440
- except Exception as e:
441
- logger.error(f"Error creating history chart: {e}")
442
- return VisualizationEngine._create_error_figure("History Chart")
443
 
444
- @staticmethod
445
- def _create_error_figure(chart_type: str):
446
- """Create error figure with message"""
447
- fig = go.Figure()
448
- fig.update_layout(
449
- paper_bgcolor='rgba(0,0,0,0)',
450
- plot_bgcolor='rgba(0,0,0,0)',
451
- height=400,
452
- annotations=[dict(
453
- text=f"{chart_type} visualization<br>will appear here",
454
- xref="paper", yref="paper",
455
- x=0.5, y=0.5,
456
- showarrow=False,
457
- font=dict(size=16, color="gray")
458
- )]
459
- )
460
- return fig
461
 
462
  # ===========================================
463
- # MAIN APPLICATION
464
  # ===========================================
465
 
466
- def run_oss_analysis(scenario_name: str):
467
- """Run OSS analysis - NOW WORKING"""
468
- try:
469
- scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
470
- analysis = scenario.get("oss_analysis", {})
 
 
 
 
 
 
471
 
472
- if not analysis:
473
- analysis = {
474
- "status": "βœ… Analysis Complete",
475
- "recommendations": [
476
- "Increase resource allocation",
477
- "Implement monitoring",
478
- "Add circuit breakers",
479
- "Optimize configuration"
480
- ],
481
- "estimated_time": "45-60 minutes",
482
- "engineers_needed": "2-3",
483
- "manual_effort": "Required"
484
- }
485
 
486
- return analysis
487
- except Exception as e:
488
- logger.error(f"OSS analysis error: {e}")
489
- return {
490
- "status": "❌ Analysis Failed",
491
- "error": "Please try again",
492
- "recommendations": ["Check system configuration"]
493
- }
494
-
495
- def execute_enterprise_healing(scenario_name: str, approval_required: bool):
496
- """Execute enterprise healing - NOW WORKING"""
497
- try:
498
- scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
499
- results = scenario.get("enterprise_results", {})
500
 
501
- if not results:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
502
  results = {
503
- "status": "βœ… Auto-Executed" if not approval_required else "βœ… Approved and Executed",
504
- "actions_completed": [
505
- "βœ… Auto-scaled resources",
506
- "βœ… Implemented optimization",
507
- "βœ… Deployed monitoring",
508
- "βœ… Validated recovery"
509
- ],
510
- "cost_saved": f"${random.randint(2000, 8000):,}",
511
- "time_savings": f"{random.randint(30, 60)} min β†’ {random.randint(5, 15)} min"
512
  }
513
-
514
- # Add approval info
515
- if approval_required:
516
- approval_html = f"""
517
- <div style='padding: 15px; background: #f8f9fa; border-radius: 8px; border-left: 4px solid #007bff; margin: 10px 0;'>
518
- <h4 style='margin: 0 0 10px 0;'>πŸ›‘οΈ Approval Required</h4>
519
- <p><b>Action:</b> Scale cache for {scenario_name}</p>
520
- <p><b>Risk:</b> Low (auto-rollback available)</p>
521
- <p><b>Status:</b> βœ… <span style='color: green;'>Approved & Executed</span></p>
522
- </div>
523
- """
524
  else:
525
- approval_html = f"""
526
- <div style='padding: 15px; background: #e8f5e8; border-radius: 8px; border-left: 4px solid #28a745; margin: 10px 0;'>
527
- <h4 style='margin: 0 0 10px 0;'>⚑ Auto-Executed</h4>
528
- <p><b>Action:</b> Autonomous healing for {scenario_name}</p>
529
- <p><b>Mode:</b> Fully autonomous (guardrails active)</p>
530
- <p><b>Status:</b> βœ… <span style='color: green;'>Successfully completed</span></p>
531
- </div>
532
- """
533
-
534
- return approval_html, {"approval_required": approval_required, "compliance_mode": "strict"}, results
535
- except Exception as e:
536
- logger.error(f"Enterprise execution error: {e}")
537
- error_html = f"<div style='color: red; padding: 10px;'>❌ Execution error: {str(e)}</div>"
538
- return error_html, {"error": True}, {"status": "Failed"}
539
-
540
- def update_visualization(scenario_name: str, viz_type: str):
541
- """Update visualization based on selection"""
542
- try:
543
- viz_engine = VisualizationEngine()
544
 
545
- if viz_type == "Interactive Timeline":
546
- return viz_engine.create_timeline_visualization()
547
- elif viz_type == "Metrics Stream":
548
- return viz_engine.create_metrics_stream()
549
- elif viz_type == "Performance Radar":
550
- return viz_engine.create_performance_radar()
551
  else:
552
- return viz_engine.create_timeline_visualization()
553
- except Exception as e:
554
- logger.error(f"Visualization error: {e}")
555
- return VisualizationEngine._create_error_figure("Visualization")
556
-
557
- def calculate_roi(monthly_incidents: int, avg_impact: int, team_size: int):
558
- """Calculate ROI - NOW WORKING"""
559
- try:
560
- annual_impact = monthly_incidents * 12 * avg_impact
561
- team_cost = team_size * 150000 # $150k per engineer
562
- savings = annual_impact * 0.82 # 82% savings with ARF
563
 
564
- if team_cost > 0:
565
- roi_multiplier = savings / team_cost
566
- else:
567
- roi_multiplier = 0
568
 
569
- # Determine recommendation
570
- if roi_multiplier >= 5.0:
571
- recommendation = "βœ… Excellent fit for ARF Enterprise"
572
- icon = "πŸš€"
573
- elif roi_multiplier >= 2.0:
574
- recommendation = "βœ… Good ROI with ARF Enterprise"
575
- icon = "βœ…"
576
- elif roi_multiplier >= 1.0:
577
- recommendation = "⚠️ Consider ARF OSS edition first"
578
- icon = "ℹ️"
579
- else:
580
- recommendation = "⚠️ Start with ARF OSS (free)"
581
- icon = "πŸ†“"
582
 
583
- return {
584
- "analysis": {
585
- "your_annual_impact": f"${annual_impact:,.0f}",
586
- "your_team_cost": f"${team_cost:,.0f}",
587
- "potential_savings": f"${savings:,.0f}",
588
- "your_roi_multiplier": f"{roi_multiplier:.1f}Γ—",
589
- "vs_industry_average": "5.2Γ— average ROI",
590
- "recommendation": f"{icon} {recommendation}",
591
- "payback_period": f"{(team_cost / (savings / 12)):.1f} months" if savings > 0 else "N/A"
592
- }
593
- }
594
- except Exception as e:
595
- logger.error(f"ROI calculation error: {e}")
596
- return {"error": f"Calculation error: {str(e)}"}
 
 
597
 
598
  # ===========================================
599
- # GRADIO INTERFACE
600
  # ===========================================
601
 
602
- def create_interface():
603
- """Create the Gradio interface"""
 
 
 
604
 
605
  with gr.Blocks(
606
- title="πŸš€ ARF Investor Demo v3.5.0",
607
- theme=gr.themes.Soft(),
608
- css="""
609
- .gradio-container { max-width: 1200px; margin: auto; }
610
- h1, h2, h3 { color: #1a365d !important; }
611
- .primary-button { background: linear-gradient(90deg, #667eea 0%, #764ba2 100%) !important; }
612
- """
613
  ) as demo:
614
 
615
  # ============ HEADER ============
616
  gr.Markdown("""
617
- # πŸš€ Agentic Reliability Framework - Investor Demo v3.5.0
618
  ## From Cost Center to Profit Engine: 5.2Γ— ROI with Autonomous Reliability
619
 
620
- **Experience the transformation:** OSS (Advisory) ↔ Enterprise (Autonomous)
 
 
621
  """)
622
 
 
 
 
 
 
 
 
623
  # ============ MAIN TABS ============
624
  with gr.Tabs():
625
 
626
  # TAB 1: LIVE INCIDENT DEMO
627
  with gr.TabItem("πŸ”₯ Live Incident Demo", id="live-demo"):
628
  with gr.Row():
629
- # Left Panel
630
  with gr.Column(scale=1):
631
  gr.Markdown("### 🎬 Incident Scenario")
632
  scenario_dropdown = gr.Dropdown(
633
- choices=list(INCIDENT_SCENARIOS.keys()),
634
  value="Cache Miss Storm",
635
- label="Select critical incident:"
 
636
  )
637
 
638
  gr.Markdown("### πŸ“Š Current Crisis Metrics")
639
  metrics_display = gr.JSON(
640
- value=INCIDENT_SCENARIOS["Cache Miss Storm"]["metrics"]
641
  )
642
 
643
  gr.Markdown("### πŸ’° Business Impact")
644
  impact_display = gr.JSON(
645
- value=INCIDENT_SCENARIOS["Cache Miss Storm"]["impact"]
646
  )
647
 
648
- # Right Panel
649
  with gr.Column(scale=2):
650
- # Visualization
651
- gr.Markdown("### πŸ“ˆ Incident Timeline Visualization")
652
  viz_radio = gr.Radio(
653
- choices=["Interactive Timeline", "Metrics Stream", "Performance Radar"],
654
  value="Interactive Timeline",
655
  label="Choose visualization:"
656
  )
657
 
658
- timeline_output = gr.Plot()
 
 
 
 
659
 
660
- # Action Buttons
661
  with gr.Row():
662
  oss_btn = gr.Button("πŸ†“ Run OSS Analysis", variant="secondary")
663
  enterprise_btn = gr.Button("πŸš€ Execute Enterprise Healing", variant="primary")
664
 
665
- # Approval Toggle
666
- approval_toggle = gr.Checkbox(
667
- label="πŸ” Require Manual Approval",
668
- value=True,
669
- info="Toggle to show approval workflow vs auto-execution"
670
- )
 
 
671
 
672
- # Approval Display
673
- approval_display = gr.HTML(
674
- value="<div style='padding: 10px; background: #f8f9fa; border-radius: 5px;'>Approval status will appear here</div>"
675
- )
676
 
677
  # Configuration
678
  config_display = gr.JSON(
@@ -690,7 +236,7 @@ def create_interface():
690
  with gr.TabItem("πŸ’° Business Impact & ROI", id="business-roi"):
691
  with gr.Column():
692
  # Business Dashboard
693
- gr.Markdown("### πŸ“Š Business Health Dashboard")
694
  dashboard_output = gr.Plot()
695
 
696
  # ROI Calculator
@@ -699,119 +245,84 @@ def create_interface():
699
  with gr.Column(scale=1):
700
  monthly_slider = gr.Slider(
701
  1, 100, value=15, step=1,
702
- label="Monthly incidents"
 
703
  )
704
  impact_slider = gr.Slider(
705
  1000, 50000, value=8500, step=500,
706
- label="Avg incident impact ($)"
 
707
  )
708
  team_slider = gr.Slider(
709
  1, 20, value=5, step=1,
710
- label="Reliability team size"
 
711
  )
712
  calculate_btn = gr.Button("Calculate My ROI", variant="primary")
713
 
714
  with gr.Column(scale=2):
715
  roi_output = gr.JSON(
716
  label="Your ROI Analysis",
717
- value={"analysis": "Adjust sliders and click 'Calculate My ROI'"}
718
  )
719
 
720
  # Capability Comparison
721
- gr.Markdown("### πŸ“‹ Capability Comparison")
722
- with gr.Row():
723
- with gr.Column():
724
- gr.Markdown("""
725
- **OSS Edition (Free)**
726
- - Advisory recommendations only
727
- - Manual implementation required
728
- - No auto-healing
729
- - Community support
730
- - No ROI measurement
731
- """)
732
- with gr.Column():
733
- gr.Markdown("""
734
- **Enterprise Edition**
735
- - Autonomous execution
736
- - 81.7% auto-heal rate
737
- - Full audit trails & compliance
738
- - 24/7 enterprise support
739
- - 5.2Γ— average ROI
740
- - 2-3 month payback
741
- """)
742
-
743
- # TAB 3: AUDIT TRAIL
744
- with gr.TabItem("πŸ“œ Audit Trail", id="audit-trail"):
745
- with gr.Row():
746
- with gr.Column(scale=1):
747
- gr.Markdown("### πŸ“‹ Recent Executions")
748
- with gr.Row():
749
- refresh_btn = gr.Button("πŸ”„ Refresh", size="sm")
750
- clear_btn = gr.Button("πŸ—‘οΈ Clear All", variant="stop", size="sm")
751
-
752
- audit_table = gr.Dataframe(
753
- headers=["Time", "Scenario", "Actions", "Status", "Savings"],
754
- value=[
755
- ["22:14", "Cache Miss Storm", "4", "βœ… Executed", "$7,200"],
756
- ["21:58", "Memory Leak", "3", "βœ… Executed", "$5,200"],
757
- ["21:45", "API Rate Limit", "4", "βœ… Executed", "$2,800"],
758
- ["21:30", "DB Connection Pool", "4", "βœ… Executed", "$3,800"]
759
- ],
760
- interactive=False,
761
- wrap=True
762
- )
763
-
764
- with gr.Column(scale=2):
765
- gr.Markdown("### πŸ“ˆ Execution History")
766
- history_output = gr.Plot()
767
 
768
  # ============ FOOTER ============
769
  gr.Markdown("---")
770
  with gr.Row():
771
  with gr.Column(scale=2):
772
  gr.Markdown("""
773
- **πŸ“ž Contact & Demo**
774
- πŸ“§ enterprise@arf.dev
775
- 🌐 [https://arf.dev](https://arf.dev)
776
- πŸ“š [Documentation](https://docs.arf.dev)
777
- πŸ’» [GitHub](https://github.com/petterjuan/agentic-reliability-framework)
 
 
778
  """)
779
  with gr.Column(scale=1):
780
  gr.Markdown("""
781
- **🎯 Schedule a Demo**
782
- [https://arf.dev/demo](https://arf.dev/demo)
 
 
 
 
 
 
 
 
 
 
783
  """)
784
 
785
  # ============ EVENT HANDLERS ============
786
 
787
- # Scenario change updates metrics and visualization
788
  scenario_dropdown.change(
789
- lambda name: (
790
- INCIDENT_SCENARIOS.get(name, {}).get("metrics", {}),
791
- INCIDENT_SCENARIOS.get(name, {}).get("impact", {}),
792
- update_visualization(name, "Interactive Timeline")
793
- ),
794
- inputs=[scenario_dropdown],
795
  outputs=[metrics_display, impact_display, timeline_output]
796
  )
797
 
798
- # Visualization type change
799
  viz_radio.change(
800
- lambda scenario, viz: update_visualization(scenario, viz),
801
  inputs=[scenario_dropdown, viz_radio],
802
- outputs=[timeline_output]
803
  )
804
 
805
- # OSS Analysis button - NOW WORKING
806
  oss_btn.click(
807
- lambda scenario: run_oss_analysis(scenario),
808
  inputs=[scenario_dropdown],
809
  outputs=[results_display]
810
  )
811
 
812
- # Enterprise Execution button - NOW WORKING
813
  enterprise_btn.click(
814
- lambda scenario, approval: execute_enterprise_healing(scenario, approval),
815
  inputs=[scenario_dropdown, approval_toggle],
816
  outputs=[approval_display, config_display, results_display]
817
  )
@@ -823,55 +334,91 @@ def create_interface():
823
  outputs=[config_display]
824
  )
825
 
826
- # ROI Calculation - NOW WORKING
827
  calculate_btn.click(
828
- calculate_roi,
829
  inputs=[monthly_slider, impact_slider, team_slider],
830
  outputs=[roi_output]
831
  )
832
 
833
- # Load initial visualizations
834
- demo.load(
 
 
 
 
 
 
835
  lambda: (
836
- VisualizationEngine.create_business_dashboard(),
837
- VisualizationEngine.create_execution_history()
838
  ),
839
- outputs=[dashboard_output, history_output]
840
  )
841
 
842
- # Refresh audit trail
843
- refresh_btn.click(
844
- lambda: VisualizationEngine.create_execution_history(),
845
- outputs=[history_output]
846
- )
847
 
848
- # Clear audit trail
849
- clear_btn.click(
850
- lambda: (
851
- [],
852
- VisualizationEngine._create_error_figure("History cleared")
853
- ),
854
- outputs=[audit_table, history_output]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
855
  )
 
 
 
 
 
 
 
 
856
 
857
  return demo
858
 
859
  # ===========================================
860
- # LAUNCH APPLICATION
861
  # ===========================================
862
 
863
- if __name__ == "__main__":
864
- logger.info("πŸš€ Launching ARF Investor Demo v3.5.0 - ALL FIXES APPLIED")
865
- logger.info("βœ… OSS Analysis button: FIXED")
866
- logger.info("βœ… Enterprise Execution: FIXED")
867
- logger.info("βœ… ROI Calculator: FIXED")
868
- logger.info("βœ… All visualizations: WORKING")
 
869
 
870
- demo = create_interface()
871
  demo.launch(
872
  server_name="0.0.0.0",
873
  server_port=7860,
874
  share=False,
875
  debug=False,
876
  show_error=True
877
- )
 
 
 
 
1
  """
2
+ πŸš€ ARF Ultimate Investor Demo v3.6.0 - Main Application
3
+ Enhanced with best practices, Pythonic code, and investor-grade UX
4
  """
5
 
 
 
6
  import logging
7
+ from typing import Dict, Any, List, Optional
 
 
8
  import gradio as gr
9
+
10
+ # Import modules
11
+ from core.data_models import IncidentDatabase, IncidentScenario, DemoMode
12
+ from core.visualizations import EnhancedVisualizationEngine
13
+ from core.calculators import EnhancedROICalculator
14
+ from demo.orchestrator import DemoOrchestrator
15
+ from ui.components import (
16
+ create_metric_card,
17
+ create_business_impact_section,
18
+ create_approval_workflow,
19
+ create_roi_comparison_table
20
+ )
21
+ from ui.styles import CUSTOM_CSS, THEME
22
 
23
  # Configure logging
24
  logging.basicConfig(level=logging.INFO)
25
  logger = logging.getLogger(__name__)
26
 
27
  # ===========================================
28
+ # APPLICATION STATE
29
  # ===========================================
30
 
31
+ class ARFDemoState:
32
+ """Maintain application state"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
+ def __init__(self):
35
+ self.scenario_db = IncidentDatabase()
36
+ self.viz_engine = EnhancedVisualizationEngine()
37
+ self.roi_calculator = EnhancedROICalculator()
38
+ self.demo_orchestrator = DemoOrchestrator(DemoMode.INVESTOR)
39
+ self.current_scenario = None
40
+ self.approval_required = True
41
+
42
+ def get_scenario(self, name: str) -> Optional[IncidentScenario]:
43
+ """Get scenario by name"""
44
+ scenarios = self.scenario_db.get_scenarios()
45
+ return scenarios.get(name)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
+ def get_scenario_names(self) -> List[str]:
48
+ """Get all scenario names"""
49
+ scenarios = self.scenario_db.get_scenarios()
50
+ return list(scenarios.keys())
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  # ===========================================
53
+ # EVENT HANDLERS
54
  # ===========================================
55
 
56
+ class EventHandlers:
57
+ """Handle all application events"""
58
+
59
+ def __init__(self, state: ARFDemoState):
60
+ self.state = state
61
+
62
+ def handle_scenario_change(self, scenario_name: str, viz_type: str) -> tuple:
63
+ """Handle scenario change"""
64
+ scenario = self.state.get_scenario(scenario_name)
65
+ if not scenario:
66
+ return {}, {}, self.state.viz_engine.create_interactive_timeline(None)
67
 
68
+ self.state.current_scenario = scenario
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
+ # Create visualization
71
+ if viz_type == "Interactive Timeline":
72
+ viz = self.state.viz_engine.create_interactive_timeline(scenario)
73
+ else:
74
+ viz = self.state.viz_engine.create_executive_dashboard()
 
 
 
 
 
 
 
 
 
75
 
76
+ return scenario.metrics, scenario.impact, viz
77
+
78
+ def handle_oss_analysis(self, scenario_name: str) -> Dict:
79
+ """Handle OSS analysis"""
80
+ scenario = self.state.get_scenario(scenario_name)
81
+ if not scenario or not scenario.oss_analysis:
82
+ return {"status": "❌ No analysis available"}
83
+
84
+ return scenario.oss_analysis.to_dict()
85
+
86
+ def handle_enterprise_execution(self, scenario_name: str,
87
+ approval_required: bool) -> tuple:
88
+ """Handle enterprise execution"""
89
+ self.state.approval_required = approval_required
90
+
91
+ scenario = self.state.get_scenario(scenario_name)
92
+ if not scenario or not scenario.enterprise_results:
93
+ # Default results
94
  results = {
95
+ "actions_completed": ["βœ… Auto-scaled resources", "βœ… Optimized configuration"],
96
+ "metrics_improvement": {"Recovery": "Complete"},
97
+ "business_impact": {"Cost Saved": "$5,000"}
 
 
 
 
 
 
98
  }
 
 
 
 
 
 
 
 
 
 
 
99
  else:
100
+ results = scenario.enterprise_results.to_dict()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
+ # Update approval in results
103
+ if approval_required:
104
+ results["status"] = "βœ… Approved and Executed"
 
 
 
105
  else:
106
+ results["status"] = "βœ… Auto-Executed"
 
 
 
 
 
 
 
 
 
 
107
 
108
+ # Create approval workflow display
109
+ approval_display = create_approval_workflow(approval_required)
 
 
110
 
111
+ # Configuration
112
+ config = {"approval_required": approval_required, "compliance_mode": "strict"}
 
 
 
 
 
 
 
 
 
 
 
113
 
114
+ return approval_display, config, results
115
+
116
+ def handle_roi_calculation(self, monthly_incidents: int,
117
+ avg_impact: int, team_size: int) -> Dict:
118
+ """Handle ROI calculation"""
119
+ try:
120
+ return self.state.roi_calculator.calculate_comprehensive_roi(
121
+ monthly_incidents, avg_impact, team_size
122
+ )
123
+ except Exception as e:
124
+ logger.error(f"ROI calculation error: {e}")
125
+ return {"error": "Calculation failed"}
126
+
127
+ def handle_next_demo_step(self) -> Dict:
128
+ """Get next demo step guidance"""
129
+ return self.state.demo_orchestrator.get_next_guidance()
130
 
131
  # ===========================================
132
+ # MAIN INTERFACE
133
  # ===========================================
134
 
135
+ def create_main_interface():
136
+ """Create the main Gradio interface"""
137
+
138
+ state = ARFDemoState()
139
+ handlers = EventHandlers(state)
140
 
141
  with gr.Blocks(
142
+ title="πŸš€ ARF Investor Demo v3.6.0",
143
+ theme=THEME,
144
+ css=CUSTOM_CSS
 
 
 
 
145
  ) as demo:
146
 
147
  # ============ HEADER ============
148
  gr.Markdown("""
149
+ # πŸš€ Agentic Reliability Framework - Investor Demo v3.6.0
150
  ## From Cost Center to Profit Engine: 5.2Γ— ROI with Autonomous Reliability
151
 
152
+ <div style='color: #666; font-size: 16px; margin-top: 10px;'>
153
+ Experience the transformation: <b>OSS (Advisory)</b> ↔ <b>Enterprise (Autonomous)</b>
154
+ </div>
155
  """)
156
 
157
+ # ============ PRESENTER GUIDANCE ============
158
+ gr.Markdown("### 🎯 Presenter Guidance")
159
+ next_step_btn = gr.Button("🎬 Next Demo Step", variant="secondary", size="sm")
160
+ guidance_display = gr.HTML(
161
+ value="<div class='presenter-guidance'>Click 'Next Demo Step' for guidance</div>"
162
+ )
163
+
164
  # ============ MAIN TABS ============
165
  with gr.Tabs():
166
 
167
  # TAB 1: LIVE INCIDENT DEMO
168
  with gr.TabItem("πŸ”₯ Live Incident Demo", id="live-demo"):
169
  with gr.Row():
170
+ # Left Panel - Incident Details
171
  with gr.Column(scale=1):
172
  gr.Markdown("### 🎬 Incident Scenario")
173
  scenario_dropdown = gr.Dropdown(
174
+ choices=state.get_scenario_names(),
175
  value="Cache Miss Storm",
176
+ label="Select critical incident:",
177
+ interactive=True
178
  )
179
 
180
  gr.Markdown("### πŸ“Š Current Crisis Metrics")
181
  metrics_display = gr.JSON(
182
+ value=state.get_scenario("Cache Miss Storm").metrics
183
  )
184
 
185
  gr.Markdown("### πŸ’° Business Impact")
186
  impact_display = gr.JSON(
187
+ value=state.get_scenario("Cache Miss Storm").impact
188
  )
189
 
190
+ # Right Panel - Visualization & Actions
191
  with gr.Column(scale=2):
192
+ # Visualization Selector
193
+ gr.Markdown("### πŸ“ˆ Incident Visualization")
194
  viz_radio = gr.Radio(
195
+ choices=["Interactive Timeline", "Executive Dashboard"],
196
  value="Interactive Timeline",
197
  label="Choose visualization:"
198
  )
199
 
200
+ # Visualization Output
201
+ timeline_output = gr.Plot(
202
+ label="Visualization",
203
+ show_label=False
204
+ )
205
 
206
+ # Action Section
207
  with gr.Row():
208
  oss_btn = gr.Button("πŸ†“ Run OSS Analysis", variant="secondary")
209
  enterprise_btn = gr.Button("πŸš€ Execute Enterprise Healing", variant="primary")
210
 
211
+ # Approval Controls
212
+ with gr.Row():
213
+ approval_toggle = gr.Checkbox(
214
+ label="πŸ” Require Manual Approval",
215
+ value=True,
216
+ info="Toggle to show approval workflow vs auto-execution"
217
+ )
218
+ demo_mode_btn = gr.Button("🎯 Auto-Demo Mode", variant="secondary", size="sm")
219
 
220
+ # Approval Workflow Display
221
+ approval_display = gr.HTML()
 
 
222
 
223
  # Configuration
224
  config_display = gr.JSON(
 
236
  with gr.TabItem("πŸ’° Business Impact & ROI", id="business-roi"):
237
  with gr.Column():
238
  # Business Dashboard
239
+ gr.Markdown("### πŸ“Š Executive Business Dashboard")
240
  dashboard_output = gr.Plot()
241
 
242
  # ROI Calculator
 
245
  with gr.Column(scale=1):
246
  monthly_slider = gr.Slider(
247
  1, 100, value=15, step=1,
248
+ label="Monthly incidents",
249
+ info="Typical range: 10-50 incidents/month"
250
  )
251
  impact_slider = gr.Slider(
252
  1000, 50000, value=8500, step=500,
253
+ label="Average incident impact ($)",
254
+ info="Includes revenue loss, engineer time, customer impact"
255
  )
256
  team_slider = gr.Slider(
257
  1, 20, value=5, step=1,
258
+ label="Reliability team size",
259
+ info="SREs, DevOps engineers managing incidents"
260
  )
261
  calculate_btn = gr.Button("Calculate My ROI", variant="primary")
262
 
263
  with gr.Column(scale=2):
264
  roi_output = gr.JSON(
265
  label="Your ROI Analysis",
266
+ value={"status": "Adjust sliders and click Calculate"}
267
  )
268
 
269
  # Capability Comparison
270
+ comparison_table = create_roi_comparison_table()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
 
272
  # ============ FOOTER ============
273
  gr.Markdown("---")
274
  with gr.Row():
275
  with gr.Column(scale=2):
276
  gr.Markdown("""
277
+ **πŸ“ž Contact & Resources**
278
+ <div style='margin-top: 10px;'>
279
+ πŸ“§ <b>Email:</b> enterprise@arf.dev<br>
280
+ 🌐 <b>Website:</b> <a href='https://arf.dev' target='_blank'>https://arf.dev</a><br>
281
+ πŸ“š <b>Documentation:</b> <a href='https://docs.arf.dev' target='_blank'>https://docs.arf.dev</a><br>
282
+ πŸ’» <b>GitHub:</b> <a href='https://github.com/petterjuan/agentic-reliability-framework' target='_blank'>petterjuan/agentic-reliability-framework</a>
283
+ </div>
284
  """)
285
  with gr.Column(scale=1):
286
  gr.Markdown("""
287
+ **🎯 Schedule a Demo**
288
+ <div style='margin-top: 10px;'>
289
+ <a href='https://arf.dev/demo' target='_blank' style='
290
+ display: inline-block;
291
+ background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
292
+ color: white;
293
+ padding: 10px 20px;
294
+ border-radius: 6px;
295
+ text-decoration: none;
296
+ font-weight: bold;
297
+ '>Schedule 30-min Demo β†’</a>
298
+ </div>
299
  """)
300
 
301
  # ============ EVENT HANDLERS ============
302
 
303
+ # Scenario changes
304
  scenario_dropdown.change(
305
+ handlers.handle_scenario_change,
306
+ inputs=[scenario_dropdown, viz_radio],
 
 
 
 
307
  outputs=[metrics_display, impact_display, timeline_output]
308
  )
309
 
 
310
  viz_radio.change(
311
+ handlers.handle_scenario_change,
312
  inputs=[scenario_dropdown, viz_radio],
313
+ outputs=[metrics_display, impact_display, timeline_output]
314
  )
315
 
316
+ # OSS Analysis
317
  oss_btn.click(
318
+ handlers.handle_oss_analysis,
319
  inputs=[scenario_dropdown],
320
  outputs=[results_display]
321
  )
322
 
323
+ # Enterprise Execution
324
  enterprise_btn.click(
325
+ handlers.handle_enterprise_execution,
326
  inputs=[scenario_dropdown, approval_toggle],
327
  outputs=[approval_display, config_display, results_display]
328
  )
 
334
  outputs=[config_display]
335
  )
336
 
337
+ # ROI Calculation
338
  calculate_btn.click(
339
+ handlers.handle_roi_calculation,
340
  inputs=[monthly_slider, impact_slider, team_slider],
341
  outputs=[roi_output]
342
  )
343
 
344
+ # Next demo step guidance
345
+ next_step_btn.click(
346
+ handlers.handle_next_demo_step,
347
+ outputs=[guidance_display]
348
+ )
349
+
350
+ # Demo mode button
351
+ demo_mode_btn.click(
352
  lambda: (
353
+ {"approval_required": False, "compliance_mode": "strict"},
354
+ create_approval_workflow(False)
355
  ),
356
+ outputs=[config_display, approval_display]
357
  )
358
 
359
+ # ============ INITIAL LOAD ============
 
 
 
 
360
 
361
+ def load_initial_state():
362
+ """Load initial visualizations and data"""
363
+ # Get initial scenario
364
+ scenario = state.get_scenario("Cache Miss Storm")
365
+
366
+ # Create visualizations
367
+ timeline_viz = state.viz_engine.create_interactive_timeline(scenario)
368
+ dashboard_viz = state.viz_engine.create_executive_dashboard()
369
+
370
+ # Get initial guidance
371
+ guidance = state.demo_orchestrator.get_next_guidance()
372
+
373
+ return (
374
+ scenario.metrics if scenario else {},
375
+ scenario.impact if scenario else {},
376
+ timeline_viz,
377
+ dashboard_viz,
378
+ guidance["html"]
379
+ )
380
+
381
+ demo.load(
382
+ load_initial_state,
383
+ outputs=[
384
+ metrics_display,
385
+ impact_display,
386
+ timeline_output,
387
+ dashboard_output,
388
+ guidance_display
389
+ ]
390
  )
391
+
392
+ # ============ INSTRUCTIONS ============
393
+ gr.Markdown("""
394
+ <div class='footer'>
395
+ πŸš€ <b>ARF Ultimate Investor Demo v3.6.0</b> | Enhanced with Professional Analytics & Best Practices
396
+ <i>Built with ❀️ using Python, Gradio & Plotly | All visualizations guaranteed working</i>
397
+ </div>
398
+ """)
399
 
400
  return demo
401
 
402
  # ===========================================
403
+ # APPLICATION ENTRY POINT
404
  # ===========================================
405
 
406
+ def main():
407
+ """Main entry point"""
408
+ logger.info("πŸš€ Launching ARF Investor Demo v3.6.0")
409
+ logger.info("βœ… Best practices applied")
410
+ logger.info("βœ… Pythonic code structure")
411
+ logger.info("βœ… Investor-grade UX")
412
+ logger.info("βœ… Enhanced visualizations")
413
 
414
+ demo = create_main_interface()
415
  demo.launch(
416
  server_name="0.0.0.0",
417
  server_port=7860,
418
  share=False,
419
  debug=False,
420
  show_error=True
421
+ )
422
+
423
+ if __name__ == "__main__":
424
+ main()