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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -609,18 +609,25 @@ def run_detailed_comparison():
609
  "Ontology-Enhanced RAG": list(enhanced_metrics.values())
610
  })
611
 
612
- # Convert data to Plotly radar chart format
613
- fig = px.line_polar(
614
- metrics_df,
615
- r=["Traditional RAG", "Ontology-Enhanced RAG"],
616
- theta="metrics",
617
- line_close=True,
618
- range_r=[0, 10],
619
- title="Context Quality Comparison"
 
 
 
 
 
 
620
  )
621
-
 
622
  st.plotly_chart(fig, use_container_width=True)
623
-
624
  st.markdown("""
625
  The figure above shows a comparison of the two RAG methods in terms of context quality. Ontology-enhanced RAG performs better in multiple dimensions:
626
 
 
609
  "Ontology-Enhanced RAG": list(enhanced_metrics.values())
610
  })
611
 
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
+
631
  st.markdown("""
632
  The figure above shows a comparison of the two RAG methods in terms of context quality. Ontology-enhanced RAG performs better in multiple dimensions:
633