Skip to content

Commit

Permalink
fix: don't select nutrition image if one has already been selected (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 authored Jun 24, 2024
1 parent ef96219 commit 68cc43d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion robotoff/insights/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down

0 comments on commit 68cc43d

Please sign in to comment.