Browse Source

Remove unused code

pull/1650/head
Hironsan 3 years ago
parent
commit
fae8a832f0
2 changed files with 2 additions and 21 deletions
  1. 17
      backend/auto_labeling/serializers.py
  2. 6
      backend/auto_labeling/views.py

17
backend/auto_labeling/serializers.py

@ -1,9 +1,6 @@
from auto_labeling_pipeline.models import RequestModelFactory
from rest_framework import serializers
from api.models import DOCUMENT_CLASSIFICATION, SEQUENCE_LABELING, SEQ2SEQ, SPEECH2TEXT, \
IMAGE_CLASSIFICATION
from api.serializers import CategorySerializer, SpanSerializer, TextLabelSerializer
from .models import AutoLabelingConfig
@ -39,17 +36,3 @@ class AutoLabelingConfigSerializer(serializers.ModelSerializer):
'You need to correctly specify the required fields: {}'.format(required_fields)
)
return data
def get_annotation_serializer(task: str):
mapping = {
DOCUMENT_CLASSIFICATION: CategorySerializer,
SEQUENCE_LABELING: SpanSerializer,
SEQ2SEQ: TextLabelSerializer,
SPEECH2TEXT: TextLabelSerializer,
IMAGE_CLASSIFICATION: CategorySerializer,
}
try:
return mapping[task]
except KeyError:
raise ValueError(f'{task} is not implemented.')

6
backend/auto_labeling/views.py

@ -19,11 +19,9 @@ from rest_framework.views import APIView
from api.models import Example, Project
from members.permissions import IsInProjectOrAdmin, IsProjectAdmin
from .pipeline.execution import execute_pipeline
from .exceptions import (AutoLabelingPermissionDenied,
AWSTokenError, SampleDataException,
TemplateMappingError, URLConnectionError)
from .exceptions import AWSTokenError, SampleDataException, TemplateMappingError, URLConnectionError
from .models import AutoLabelingConfig
from .serializers import (AutoLabelingConfigSerializer, get_annotation_serializer)
from .serializers import AutoLabelingConfigSerializer
class TemplateListAPI(APIView):

Loading…
Cancel
Save