Update app.py
Browse files
app.py
CHANGED
|
@@ -572,10 +572,10 @@ def create_timeline_plot(scenario_name: str):
|
|
| 572 |
return fig
|
| 573 |
|
| 574 |
# ===========================================
|
| 575 |
-
# SCENARIO UPDATE HANDLER
|
| 576 |
# ===========================================
|
| 577 |
-
def update_scenario_display(scenario_name: str) ->
|
| 578 |
-
"""Update all scenario-related displays"""
|
| 579 |
scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
|
| 580 |
impact = scenario.get("business_impact", {})
|
| 581 |
metrics = scenario.get("metrics", {})
|
|
@@ -619,12 +619,13 @@ def update_scenario_display(scenario_name: str) -> dict:
|
|
| 619 |
impact_plot = create_impact_plot(scenario_name)
|
| 620 |
timeline_plot = create_timeline_plot(scenario_name)
|
| 621 |
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
|
|
|
| 628 |
|
| 629 |
# ===========================================
|
| 630 |
# CREATE DEMO INTERFACE - UPDATED FOR ENHANCED TAB 1
|
|
@@ -693,16 +694,11 @@ def create_demo_interface():
|
|
| 693 |
|
| 694 |
# ============ EVENT HANDLERS FOR ENHANCED TAB 1 ============
|
| 695 |
|
| 696 |
-
# Update scenario display when dropdown changes
|
| 697 |
scenario_dropdown.change(
|
| 698 |
fn=update_scenario_display,
|
| 699 |
inputs=[scenario_dropdown],
|
| 700 |
-
outputs=
|
| 701 |
-
scenario_card: gr.HTML(),
|
| 702 |
-
telemetry_viz: gr.Plot(),
|
| 703 |
-
impact_viz: gr.Plot(),
|
| 704 |
-
timeline_viz: gr.Plot()
|
| 705 |
-
}
|
| 706 |
)
|
| 707 |
|
| 708 |
# Run OSS Analysis
|
|
@@ -960,10 +956,7 @@ def create_demo_interface():
|
|
| 960 |
"""
|
| 961 |
|
| 962 |
return (
|
| 963 |
-
update_result[
|
| 964 |
-
update_result["telemetry_plot"],
|
| 965 |
-
update_result["impact_plot"],
|
| 966 |
-
update_result["timeline_plot"],
|
| 967 |
oss_result[0], oss_result[1], oss_result[2], # Agent updates
|
| 968 |
oss_result[3], # OSS results
|
| 969 |
demo_message, # Demo message
|
|
|
|
| 572 |
return fig
|
| 573 |
|
| 574 |
# ===========================================
|
| 575 |
+
# SCENARIO UPDATE HANDLER - UPDATED TO RETURN TUPLE
|
| 576 |
# ===========================================
|
| 577 |
+
def update_scenario_display(scenario_name: str) -> tuple:
|
| 578 |
+
"""Update all scenario-related displays - returns tuple for gradio compatibility"""
|
| 579 |
scenario = INCIDENT_SCENARIOS.get(scenario_name, {})
|
| 580 |
impact = scenario.get("business_impact", {})
|
| 581 |
metrics = scenario.get("metrics", {})
|
|
|
|
| 619 |
impact_plot = create_impact_plot(scenario_name)
|
| 620 |
timeline_plot = create_timeline_plot(scenario_name)
|
| 621 |
|
| 622 |
+
# Return as tuple for gradio compatibility
|
| 623 |
+
return (
|
| 624 |
+
scenario_html,
|
| 625 |
+
telemetry_plot,
|
| 626 |
+
impact_plot,
|
| 627 |
+
timeline_plot
|
| 628 |
+
)
|
| 629 |
|
| 630 |
# ===========================================
|
| 631 |
# CREATE DEMO INTERFACE - UPDATED FOR ENHANCED TAB 1
|
|
|
|
| 694 |
|
| 695 |
# ============ EVENT HANDLERS FOR ENHANCED TAB 1 ============
|
| 696 |
|
| 697 |
+
# Update scenario display when dropdown changes - FIXED: Using tuple outputs
|
| 698 |
scenario_dropdown.change(
|
| 699 |
fn=update_scenario_display,
|
| 700 |
inputs=[scenario_dropdown],
|
| 701 |
+
outputs=[scenario_card, telemetry_viz, impact_viz, timeline_viz]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 702 |
)
|
| 703 |
|
| 704 |
# Run OSS Analysis
|
|
|
|
| 956 |
"""
|
| 957 |
|
| 958 |
return (
|
| 959 |
+
update_result[0], update_result[1], update_result[2], update_result[3], # Scenario components
|
|
|
|
|
|
|
|
|
|
| 960 |
oss_result[0], oss_result[1], oss_result[2], # Agent updates
|
| 961 |
oss_result[3], # OSS results
|
| 962 |
demo_message, # Demo message
|