From a4c29aa495bf76a50fc7e637138275249c960f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Hvilsh=C3=B8j?= <93145535+frederik-encord@users.noreply.github.com> Date: Wed, 5 Jul 2023 19:22:15 +0200 Subject: [PATCH] fix: annotator statistics dont crash if all scores are zero (#543) --- .../app/common/components/annotator_statistics.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/encord_active/app/common/components/annotator_statistics.py b/src/encord_active/app/common/components/annotator_statistics.py index 5534e0738..4d34fca8a 100644 --- a/src/encord_active/app/common/components/annotator_statistics.py +++ b/src/encord_active/app/common/components/annotator_statistics.py @@ -13,15 +13,20 @@ def render_annotator_properties(df: DataFrame[MetricSchema]): annotators = get_annotator_level_info(df) if len(annotators) == 0: + st.warning("Found no annotators") return - left_col, right_col = st.columns([2, 2]) + annotators_df = pd.DataFrame(list(annotators.values())) + total_annotations = annotators_df["total_annotations"].sum() + if not total_annotations: + st.warning("No annotations to show") + return + left_col, right_col = st.columns([2, 2]) # 1. Pie Chart left_col.markdown( "