Spaces:
Running
Running
Update app.py
Browse files
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 |
-
#
|
| 616 |
-
plot_df =
|
| 617 |
-
|
| 618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 619 |
fig = px.bar_polar(
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 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 |
|