Spaces:
Sleeping
Sleeping
Commit Β·
d94ee10
1
Parent(s): a37155b
Fix: Replace width='stretch' with use_container_width=True for Streamlit 1.35.0 compatibility
Browse files- src/ui_app.py +10 -10
src/ui_app.py
CHANGED
|
@@ -469,12 +469,12 @@ def display_premium_metrics(evaluation_result: Dict, reflection_result: Dict):
|
|
| 469 |
with col1:
|
| 470 |
context_rel = metrics.get('context_relevance', 0)
|
| 471 |
fig = create_gauge_chart(context_rel, "Context Relevance")
|
| 472 |
-
st.plotly_chart(fig,
|
| 473 |
|
| 474 |
with col2:
|
| 475 |
reflection_score = reflection_result.get('score', 0)
|
| 476 |
fig = create_gauge_chart(reflection_score, "Overall Quality")
|
| 477 |
-
st.plotly_chart(fig,
|
| 478 |
|
| 479 |
with col3:
|
| 480 |
# Calculate average score
|
|
@@ -490,7 +490,7 @@ def display_premium_metrics(evaluation_result: Dict, reflection_result: Dict):
|
|
| 490 |
avg_score /= count
|
| 491 |
|
| 492 |
fig = create_gauge_chart(avg_score if count > 0 else reflection_score, "Combined Score")
|
| 493 |
-
st.plotly_chart(fig,
|
| 494 |
|
| 495 |
# Bottom row - Key stats
|
| 496 |
st.markdown("### Key Statistics")
|
|
@@ -543,7 +543,7 @@ def display_premium_metrics(evaluation_result: Dict, reflection_result: Dict):
|
|
| 543 |
'ROUGE-L': metrics["rouge"].get('rougeL', 0)
|
| 544 |
}
|
| 545 |
fig = create_bar_chart(rouge_data, "ROUGE Score Analysis")
|
| 546 |
-
st.plotly_chart(fig,
|
| 547 |
else:
|
| 548 |
st.info("π‘ Add a reference answer to see ROUGE scores")
|
| 549 |
|
|
@@ -556,7 +556,7 @@ def display_premium_metrics(evaluation_result: Dict, reflection_result: Dict):
|
|
| 556 |
'F1 Score': metrics["bertscore"].get('f1', 0)
|
| 557 |
}
|
| 558 |
fig = create_bar_chart(bert_data, "BERTScore Analysis")
|
| 559 |
-
st.plotly_chart(fig,
|
| 560 |
else:
|
| 561 |
st.info("π‘ Add a reference answer to see BERTScore")
|
| 562 |
|
|
@@ -608,7 +608,7 @@ def display_premium_metrics(evaluation_result: Dict, reflection_result: Dict):
|
|
| 608 |
if breakdown:
|
| 609 |
st.markdown("#### π Score Breakdown")
|
| 610 |
fig = create_radar_chart(breakdown)
|
| 611 |
-
st.plotly_chart(fig,
|
| 612 |
|
| 613 |
with tab4:
|
| 614 |
st.markdown("### Detailed Evaluation Report")
|
|
@@ -642,7 +642,7 @@ def display_premium_metrics(evaluation_result: Dict, reflection_result: Dict):
|
|
| 642 |
data=json_str,
|
| 643 |
file_name=f"rag_evaluation_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json",
|
| 644 |
mime="application/json",
|
| 645 |
-
|
| 646 |
)
|
| 647 |
|
| 648 |
|
|
@@ -713,7 +713,7 @@ def main():
|
|
| 713 |
]
|
| 714 |
|
| 715 |
for icon, query in sample_queries:
|
| 716 |
-
if st.button(f"{icon} {query}", key=f"sample_{query}",
|
| 717 |
st.session_state["query"] = query
|
| 718 |
|
| 719 |
st.markdown("---")
|
|
@@ -753,9 +753,9 @@ def main():
|
|
| 753 |
|
| 754 |
col1, col2, col3, col4, col5 = st.columns([2, 2, 2, 2, 2])
|
| 755 |
with col1:
|
| 756 |
-
submit_button = st.button("π **Ask Question**", type="primary",
|
| 757 |
with col2:
|
| 758 |
-
clear_button = st.button("ποΈ **Clear**",
|
| 759 |
|
| 760 |
if clear_button:
|
| 761 |
st.session_state.clear()
|
|
|
|
| 469 |
with col1:
|
| 470 |
context_rel = metrics.get('context_relevance', 0)
|
| 471 |
fig = create_gauge_chart(context_rel, "Context Relevance")
|
| 472 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 473 |
|
| 474 |
with col2:
|
| 475 |
reflection_score = reflection_result.get('score', 0)
|
| 476 |
fig = create_gauge_chart(reflection_score, "Overall Quality")
|
| 477 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 478 |
|
| 479 |
with col3:
|
| 480 |
# Calculate average score
|
|
|
|
| 490 |
avg_score /= count
|
| 491 |
|
| 492 |
fig = create_gauge_chart(avg_score if count > 0 else reflection_score, "Combined Score")
|
| 493 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 494 |
|
| 495 |
# Bottom row - Key stats
|
| 496 |
st.markdown("### Key Statistics")
|
|
|
|
| 543 |
'ROUGE-L': metrics["rouge"].get('rougeL', 0)
|
| 544 |
}
|
| 545 |
fig = create_bar_chart(rouge_data, "ROUGE Score Analysis")
|
| 546 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 547 |
else:
|
| 548 |
st.info("π‘ Add a reference answer to see ROUGE scores")
|
| 549 |
|
|
|
|
| 556 |
'F1 Score': metrics["bertscore"].get('f1', 0)
|
| 557 |
}
|
| 558 |
fig = create_bar_chart(bert_data, "BERTScore Analysis")
|
| 559 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 560 |
else:
|
| 561 |
st.info("π‘ Add a reference answer to see BERTScore")
|
| 562 |
|
|
|
|
| 608 |
if breakdown:
|
| 609 |
st.markdown("#### π Score Breakdown")
|
| 610 |
fig = create_radar_chart(breakdown)
|
| 611 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 612 |
|
| 613 |
with tab4:
|
| 614 |
st.markdown("### Detailed Evaluation Report")
|
|
|
|
| 642 |
data=json_str,
|
| 643 |
file_name=f"rag_evaluation_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json",
|
| 644 |
mime="application/json",
|
| 645 |
+
use_container_width=True
|
| 646 |
)
|
| 647 |
|
| 648 |
|
|
|
|
| 713 |
]
|
| 714 |
|
| 715 |
for icon, query in sample_queries:
|
| 716 |
+
if st.button(f"{icon} {query}", key=f"sample_{query}", use_container_width=True):
|
| 717 |
st.session_state["query"] = query
|
| 718 |
|
| 719 |
st.markdown("---")
|
|
|
|
| 753 |
|
| 754 |
col1, col2, col3, col4, col5 = st.columns([2, 2, 2, 2, 2])
|
| 755 |
with col1:
|
| 756 |
+
submit_button = st.button("π **Ask Question**", type="primary", use_container_width=True)
|
| 757 |
with col2:
|
| 758 |
+
clear_button = st.button("ποΈ **Clear**", use_container_width=True)
|
| 759 |
|
| 760 |
if clear_button:
|
| 761 |
st.session_state.clear()
|