AD2000X commited on
Commit
1c291eb
·
verified ·
1 Parent(s): ee23c66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -612,19 +612,27 @@ def run_detailed_comparison():
612
  # Filter out columns with incomplete data to avoid inconsistencies between theta and r
613
  plot_df = df.dropna(subset=["Metric", "Value", "Method"])
614
 
615
- # Ensure the transformation is correct
616
- plot_df = plot_df.astype({"Metric": str, "Value": float, "Method": str})
617
-
618
- # Use bar_polar to avoid wiring errors
 
 
 
 
 
 
 
 
619
  fig = px.bar_polar(
620
- plot_df,
621
- r="Value",
622
- theta="Metric",
623
- color="Method",
624
- title="Context Quality Assessment (Polar View)",
625
- color_discrete_sequence=px.colors.qualitative.Set2
626
  )
627
-
628
  fig.update_layout(polar=dict(radialaxis=dict(visible=True)), showlegend=True)
629
  st.plotly_chart(fig, use_container_width=True)
630
 
 
612
  # Filter out columns with incomplete data to avoid inconsistencies between theta and r
613
  plot_df = df.dropna(subset=["Metric", "Value", "Method"])
614
 
615
+ # # Convert wide-format to long-format
616
+ plot_df = metrics_df.melt(
617
+ id_vars=["metrics"],
618
+ value_vars=["Traditional RAG", "Ontology-Enhanced RAG"],
619
+ var_name="Method",
620
+ value_name="Value"
621
+ )
622
+
623
+ # Type confirmation (optional but stable)
624
+ plot_df = plot_df.astype({"metrics": str, "Value": float, "Method": str})
625
+
626
+ # draw bar_polar graph
627
  fig = px.bar_polar(
628
+ plot_df,
629
+ r="Value",
630
+ theta="metrics",
631
+ color="Method",
632
+ title="Context Quality Assessment (Polar View)",
633
+ color_discrete_sequence=px.colors.qualitative.Set2
634
  )
635
+
636
  fig.update_layout(polar=dict(radialaxis=dict(visible=True)), showlegend=True)
637
  st.plotly_chart(fig, use_container_width=True)
638