petter2025 commited on
Commit
fb680d1
Β·
verified Β·
1 Parent(s): c9700de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -19
app.py CHANGED
@@ -4,6 +4,7 @@
4
  # UPDATED: Added realism panel integration for enterprise-seasoned SRE experience
5
  # UPDATED: Added dynamic performance metrics for Phase 2
6
  # SURGICAL FIX: Fixed AsyncRunner.async_to_sync contract violation
 
7
 
8
  import logging
9
  import sys
@@ -918,7 +919,7 @@ async def run_true_arf_analysis(scenario_name: str) -> tuple:
918
  text-align: center; flex: 1; margin: 5px; min-height: 180px;">
919
  <div style="font-size: 32px; margin-bottom: 10px; color: {boundary_color};">πŸ•΅οΈβ€β™‚οΈ</div>
920
  <div style="width: 100%;">
921
- <h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b;">Detection Agent</h4>
922
  <p style="font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.4;">
923
  {confidence_text}
924
  </p>
@@ -958,7 +959,7 @@ async def run_true_arf_analysis(scenario_name: str) -> tuple:
958
  text-align: center; flex: 1; margin: 5px; min-height: 180px;">
959
  <div style="font-size: 32px; margin-bottom: 10px; color: {boundary_color};">🧠</div>
960
  <div style="width: 100%;">
961
- <h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b;">Recall Agent</h4>
962
  <p style="font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.4;">
963
  {recall_text}
964
  </p>
@@ -998,7 +999,7 @@ async def run_true_arf_analysis(scenario_name: str) -> tuple:
998
  text-align: center; flex: 1; margin: 5px; min-height: 180px;">
999
  <div style="font-size: 32px; margin-bottom: 10px; color: {boundary_color};">🎯</div>
1000
  <div style="width: 100%;">
1001
- <h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b;">Decision Agent</h4>
1002
  <p style="font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.4;">
1003
  {decision_text}
1004
  </p>
@@ -2207,14 +2208,26 @@ def create_demo_interface():
2207
  # ============ 5 TABS ============
2208
  with gr.Tabs(elem_classes="tab-nav"):
2209
 
2210
- # TAB 1: Live Incident Demo - NOW WITH REALISM PANEL
2211
  with gr.TabItem("πŸ”₯ Live Incident Demo", id="tab1"):
2212
- (scenario_dropdown, scenario_card, telemetry_viz, impact_viz,
2213
- workflow_header, detection_agent, recall_agent, decision_agent,
 
 
 
 
 
 
 
 
 
 
 
2214
  oss_section, enterprise_section, oss_btn, enterprise_btn,
2215
- approval_toggle, mcp_mode, timeline_viz, realism_panel,
2216
  detection_time, mttr, auto_heal, savings,
2217
  oss_results_display, enterprise_results_display, approval_display, demo_btn) = components["create_tab1_incident_demo"]()
 
2218
 
2219
  # TAB 2: Business ROI
2220
  with gr.TabItem("πŸ’° Business Impact & ROI", id="tab2"):
@@ -2247,8 +2260,9 @@ def create_demo_interface():
2247
  fn=update_scenario_display_with_metrics, # ← Changed to combined function
2248
  inputs=[scenario_dropdown],
2249
  outputs=[
2250
- scenario_card, telemetry_viz, impact_viz, timeline_viz, realism_panel,
2251
  detection_time, mttr, auto_heal, savings # 4 new outputs for metrics
 
2252
  ]
2253
  )
2254
 
@@ -2268,7 +2282,7 @@ def create_demo_interface():
2268
  fn=run_oss_analysis_real_arf,
2269
  inputs=[scenario_dropdown],
2270
  outputs=[
2271
- detection_agent, recall_agent, decision_agent,
2272
  oss_results_display, incident_table
2273
  ]
2274
  )
@@ -2474,8 +2488,8 @@ def create_demo_interface():
2474
 
2475
  # Combine all results
2476
  return (
2477
- *update_result, # 9 outputs: scenario_card, telemetry_viz, impact_viz, timeline_viz, realism_panel, detection_time, mttr, auto_heal, savings
2478
- *oss_result[:3], # 3 outputs: detection_agent, recall_agent, decision_agent
2479
  oss_result[3], # 1 output: oss_results_display
2480
  enterprise_results, # 1 output: enterprise_results_display
2481
  demo_message, # 1 output: approval_display
@@ -2488,9 +2502,9 @@ def create_demo_interface():
2488
  fn=run_complete_demo_async,
2489
  inputs=[scenario_dropdown],
2490
  outputs=[
2491
- scenario_card, telemetry_viz, impact_viz, timeline_viz, realism_panel,
2492
- detection_time, mttr, auto_heal, savings, # 9
2493
- detection_agent, recall_agent, decision_agent, # 3
2494
  oss_results_display, # 1
2495
  enterprise_results_display, # 1
2496
  approval_display, # 1
@@ -2603,12 +2617,12 @@ def create_demo_interface():
2603
  outputs=[license_display]
2604
  )
2605
 
2606
- # Load default scenario - UPDATE outputs with realism_panel AND performance metrics
2607
  demo.load(
2608
  fn=lambda: update_scenario_display_with_metrics(settings.default_scenario),
2609
  inputs=[],
2610
  outputs=[
2611
- scenario_card, telemetry_viz, impact_viz, timeline_viz, realism_panel,
2612
  detection_time, mttr, auto_heal, savings
2613
  ]
2614
  )
@@ -2620,7 +2634,7 @@ def create_demo_interface():
2620
  outputs=[roi_output, roi_chart]
2621
  )
2622
 
2623
- logger.info("βœ… Demo interface created successfully with boundary awareness, realism panel, and dynamic performance metrics")
2624
 
2625
  return demo
2626
  # ===========================================
@@ -2702,7 +2716,7 @@ if __name__ == "__main__":
2702
  logger.info("πŸš€ ARF Ultimate Investor Demo v3.3.9 - ENTERPRISE EDITION")
2703
  logger.info("=" * 60)
2704
  logger.info("Enhanced with clear OSS vs Enterprise boundaries")
2705
- logger.info("Now with Realism Panel for enterprise-seasoned SRE experience")
2706
  logger.info("PHASE 2: Dynamic Performance Metrics by Scenario")
2707
  logger.info(f"True ARF OSS v3.3.9 integration with simulated Enterprise execution")
2708
  logger.info("=" * 60)
@@ -2713,7 +2727,7 @@ if __name__ == "__main__":
2713
  print("\n" + "="*60)
2714
  print("πŸš€ ARF Ultimate Investor Demo v3.3.9 - ENTERPRISE EDITION")
2715
  print("πŸ“Š Architecture: OSS advises β†’ Enterprise executes")
2716
- print("🎭 Phase 2: Dynamic Performance Metrics by Scenario")
2717
  print("🌐 Starting on http://localhost:7860")
2718
  print("="*60 + "\n")
2719
 
 
4
  # UPDATED: Added realism panel integration for enterprise-seasoned SRE experience
5
  # UPDATED: Added dynamic performance metrics for Phase 2
6
  # SURGICAL FIX: Fixed AsyncRunner.async_to_sync contract violation
7
+ # DOCTRINAL FIX: Updated unpacking contract from 24 to 26 values
8
 
9
  import logging
10
  import sys
 
919
  text-align: center; flex: 1; margin: 5px; min-height: 180px;">
920
  <div style="font-size: 32px; margin-bottom: 10px; color: {boundary_color};">πŸ•΅οΈβ€β™‚οΈ</div>
921
  <div style="width: 100%;">
922
+ <h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b;">Detection Process</h4>
923
  <p style="font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.4;">
924
  {confidence_text}
925
  </p>
 
959
  text-align: center; flex: 1; margin: 5px; min-height: 180px;">
960
  <div style="font-size: 32px; margin-bottom: 10px; color: {boundary_color};">🧠</div>
961
  <div style="width: 100%;">
962
+ <h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b;">Recall Process</h4>
963
  <p style="font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.4;">
964
  {recall_text}
965
  </p>
 
999
  text-align: center; flex: 1; margin: 5px; min-height: 180px;">
1000
  <div style="font-size: 32px; margin-bottom: 10px; color: {boundary_color};">🎯</div>
1001
  <div style="width: 100%;">
1002
+ <h4 style="margin: 0 0 8px 0; font-size: 16px; color: #1e293b;">Decision Process</h4>
1003
  <p style="font-size: 13px; color: #64748b; margin-bottom: 12px; line-height: 1.4;">
1004
  {decision_text}
1005
  </p>
 
2208
  # ============ 5 TABS ============
2209
  with gr.Tabs(elem_classes="tab-nav"):
2210
 
2211
+ # TAB 1: Live Incident Demo - NOW WITH DOCTRINAL COMPONENTS
2212
  with gr.TabItem("πŸ”₯ Live Incident Demo", id="tab1"):
2213
+ # ===== SURGICAL FIX: LINE 2739 UNPACKING CONTRACT UPDATE =====
2214
+ # OLD (incorrect - expecting 24 values):
2215
+ # (scenario_dropdown, scenario_card, telemetry_viz, impact_viz,
2216
+ # workflow_header, detection_agent, recall_agent, decision_agent,
2217
+ # oss_section, enterprise_section, oss_btn, enterprise_btn,
2218
+ # approval_toggle, mcp_mode, timeline_viz, realism_panel,
2219
+ # detection_time, mttr, auto_heal, savings,
2220
+ # oss_results_display, enterprise_results_display, approval_display, demo_btn) = components["create_tab1_incident_demo"]()
2221
+
2222
+ # NEW (correct - expecting 26 doctrinal values):
2223
+ (scenario_dropdown, historical_panel, scenario_card, telemetry_viz, impact_viz,
2224
+ observation_gate_placeholder, sequencing_panel, workflow_header,
2225
+ detection_process, recall_process, decision_process,
2226
  oss_section, enterprise_section, oss_btn, enterprise_btn,
2227
+ approval_toggle, mcp_mode, timeline_viz,
2228
  detection_time, mttr, auto_heal, savings,
2229
  oss_results_display, enterprise_results_display, approval_display, demo_btn) = components["create_tab1_incident_demo"]()
2230
+ # ===== END SURGICAL FIX =====
2231
 
2232
  # TAB 2: Business ROI
2233
  with gr.TabItem("πŸ’° Business Impact & ROI", id="tab2"):
 
2260
  fn=update_scenario_display_with_metrics, # ← Changed to combined function
2261
  inputs=[scenario_dropdown],
2262
  outputs=[
2263
+ scenario_card, telemetry_viz, impact_viz, timeline_viz,
2264
  detection_time, mttr, auto_heal, savings # 4 new outputs for metrics
2265
+ # Note: realism_panel removed as it's now replaced by doctrinal components
2266
  ]
2267
  )
2268
 
 
2282
  fn=run_oss_analysis_real_arf,
2283
  inputs=[scenario_dropdown],
2284
  outputs=[
2285
+ detection_process, recall_process, decision_process,
2286
  oss_results_display, incident_table
2287
  ]
2288
  )
 
2488
 
2489
  # Combine all results
2490
  return (
2491
+ *update_result, # 8 outputs: scenario_card, telemetry_viz, impact_viz, timeline_viz, detection_time, mttr, auto_heal, savings
2492
+ *oss_result[:3], # 3 outputs: detection_process, recall_process, decision_process
2493
  oss_result[3], # 1 output: oss_results_display
2494
  enterprise_results, # 1 output: enterprise_results_display
2495
  demo_message, # 1 output: approval_display
 
2502
  fn=run_complete_demo_async,
2503
  inputs=[scenario_dropdown],
2504
  outputs=[
2505
+ scenario_card, telemetry_viz, impact_viz, timeline_viz,
2506
+ detection_time, mttr, auto_heal, savings, # 8
2507
+ detection_process, recall_process, decision_process, # 3
2508
  oss_results_display, # 1
2509
  enterprise_results_display, # 1
2510
  approval_display, # 1
 
2617
  outputs=[license_display]
2618
  )
2619
 
2620
+ # Load default scenario - UPDATE outputs without realism_panel
2621
  demo.load(
2622
  fn=lambda: update_scenario_display_with_metrics(settings.default_scenario),
2623
  inputs=[],
2624
  outputs=[
2625
+ scenario_card, telemetry_viz, impact_viz, timeline_viz,
2626
  detection_time, mttr, auto_heal, savings
2627
  ]
2628
  )
 
2634
  outputs=[roi_output, roi_chart]
2635
  )
2636
 
2637
+ logger.info("βœ… Demo interface created successfully with boundary awareness, doctrinal components, and dynamic performance metrics")
2638
 
2639
  return demo
2640
  # ===========================================
 
2716
  logger.info("πŸš€ ARF Ultimate Investor Demo v3.3.9 - ENTERPRISE EDITION")
2717
  logger.info("=" * 60)
2718
  logger.info("Enhanced with clear OSS vs Enterprise boundaries")
2719
+ logger.info("DOCTRINAL COMPLIANCE: Historical Evidence, Observation Gate, Sequencing")
2720
  logger.info("PHASE 2: Dynamic Performance Metrics by Scenario")
2721
  logger.info(f"True ARF OSS v3.3.9 integration with simulated Enterprise execution")
2722
  logger.info("=" * 60)
 
2727
  print("\n" + "="*60)
2728
  print("πŸš€ ARF Ultimate Investor Demo v3.3.9 - ENTERPRISE EDITION")
2729
  print("πŸ“Š Architecture: OSS advises β†’ Enterprise executes")
2730
+ print("🎭 DOCTRINAL: Historical Evidence + Observation Gate + Sequencing")
2731
  print("🌐 Starting on http://localhost:7860")
2732
  print("="*60 + "\n")
2733