diff --git a/robotoff/insights/annotate.py b/robotoff/insights/annotate.py index c75a6617c4..f403f97591 100644 --- a/robotoff/insights/annotate.py +++ b/robotoff/insights/annotate.py @@ -623,6 +623,12 @@ def process_annotation( description="the image is invalid", ) + image_key = f"nutrition_{insight.value_tag}" + # We don't want to select the nutrition image if one has already been + # selected + if image_key in images: + return ALREADY_ANNOTATED_RESULT + rotation = insight.data.get("rotation", 0) crop_bounding_box: Optional[tuple[float, float, float, float]] = None if "bounding_box" in insight.data: @@ -635,7 +641,6 @@ def process_annotation( insight.data["bounding_box"], width, height, rotation ) - image_key = f"nutrition_{insight.value_tag}" select_rotate_image( product_id=product_id, image_id=image_id,