Tag-hover → crop-region grounding overlay (#1206, milestone #133) #195

Merged
bvandeusen merged 5 commits from dev into main 2026-07-06 13:29:31 -04:00
Showing only changes of commit 2638cf1a35 - Show all commits
+4 -10
View File
@@ -1,4 +1,8 @@
import pytest
from sqlalchemy import select
from backend.app.models import ImageRecord, ImageRegion, MLSettings, TagHead, TagKind
from backend.app.services.tag_service import TagService
pytestmark = pytest.mark.integration
@@ -104,13 +108,6 @@ async def test_applied_tag_grounding_returns_winning_region(client, db):
# Hovering an applied chip fetches the crop that best explains the tag. Here
# the whole-image vector is orthogonal to the head but a concept crop aligns,
# so the crop wins the max-over-bag → grounding is that region's box.
from sqlalchemy import select
from backend.app.models import (
ImageRecord, ImageRegion, MLSettings, TagHead, TagKind,
)
from backend.app.services.tag_service import TagService
ver = (await db.execute(
select(MLSettings).where(MLSettings.id == 1)
)).scalar_one().embedder_model_version
@@ -148,9 +145,6 @@ async def test_applied_tag_grounding_returns_winning_region(client, db):
async def test_applied_tag_grounding_no_head(client, db):
# A tag with no head can't be localized → has_head False, grounding null; the
# chip shows no overlay. Validates the response contract the frontend reads.
from backend.app.models import ImageRecord, TagKind
from backend.app.services.tag_service import TagService
img = ImageRecord(
path="/images/grchip2.jpg", sha256="gd" * 32, size_bytes=1,
mime="image/jpeg", width=1, height=1, origin="imported_filesystem",