|
|
@ -4,7 +4,7 @@ from django.db import models |
|
|
|
from django.contrib.auth.models import User |
|
|
|
from django.contrib.staticfiles.storage import staticfiles_storage |
|
|
|
|
|
|
|
from .serializers import * |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Project(models.Model): |
|
|
@ -66,6 +66,9 @@ class Project(models.Model): |
|
|
|
return docs |
|
|
|
|
|
|
|
def get_project_serializer(self): |
|
|
|
from .serializers import DocumentSerializer |
|
|
|
from .serializers import SequenceSerializer |
|
|
|
from .serializers import Seq2seqSerializer |
|
|
|
if self.is_type_of(Project.DOCUMENT_CLASSIFICATION): |
|
|
|
return DocumentSerializer |
|
|
|
elif self.is_type_of(Project.SEQUENCE_LABELING): |
|
|
@ -76,6 +79,9 @@ class Project(models.Model): |
|
|
|
raise ValueError('Invalid project_type') |
|
|
|
|
|
|
|
def get_annotation_serializer(self): |
|
|
|
from .serializers import DocumentAnnotationSerializer |
|
|
|
from .serializers import SequenceAnnotationSerializer |
|
|
|
from .serializers import Seq2seqAnnotationSerializer |
|
|
|
if self.is_type_of(Project.DOCUMENT_CLASSIFICATION): |
|
|
|
return DocumentAnnotationSerializer |
|
|
|
elif self.is_type_of(Project.SEQUENCE_LABELING): |
|
|
|