diff --git a/backend/labels/urls.py b/backend/labels/urls.py index 175a280b..5fb77cf4 100644 --- a/backend/labels/urls.py +++ b/backend/labels/urls.py @@ -7,6 +7,8 @@ from .views import ( CategoryListAPI, RelationDetail, RelationList, + SegmentationDetailAPI, + SegmentationListAPI, SpanDetailAPI, SpanListAPI, TextLabelDetailAPI, @@ -40,4 +42,10 @@ urlpatterns = [ view=BoundingBoxDetailAPI.as_view(), name="bbox_detail", ), + path(route="examples//segments", view=SegmentationListAPI.as_view(), name="segment_list"), + path( + route="examples//segments/", + view=SegmentationDetailAPI.as_view(), + name="segment_detail", + ), ] diff --git a/backend/labels/views.py b/backend/labels/views.py index 8ad72819..c43f023e 100644 --- a/backend/labels/views.py +++ b/backend/labels/views.py @@ -12,10 +12,19 @@ from .serializers import ( BoundingBoxSerializer, CategorySerializer, RelationSerializer, + SegmentationSerializer, SpanSerializer, TextLabelSerializer, ) -from labels.models import BoundingBox, Category, Label, Relation, Span, TextLabel +from labels.models import ( + BoundingBox, + Category, + Label, + Relation, + Segmentation, + Span, + TextLabel, +) from projects.models import Project from projects.permissions import IsProjectMember @@ -122,3 +131,13 @@ class BoundingBoxListAPI(BaseListAPI): class BoundingBoxDetailAPI(BaseDetailAPI): queryset = BoundingBox.objects.all() serializer_class = BoundingBoxSerializer + + +class SegmentationListAPI(BaseListAPI): + label_class = Segmentation + serializer_class = SegmentationSerializer + + +class SegmentationDetailAPI(BaseDetailAPI): + queryset = Segmentation.objects.all() + serializer_class = SegmentationSerializer