|
|
@ -64,6 +64,12 @@ class Speech2textProject(Project): |
|
|
|
return Speech2textAnnotation |
|
|
|
|
|
|
|
|
|
|
|
class ImageClassificationProject(Project): |
|
|
|
|
|
|
|
def get_annotation_class(self): |
|
|
|
return ImageCategoryLabel |
|
|
|
|
|
|
|
|
|
|
|
class Label(models.Model): |
|
|
|
PREFIX_KEYS = ( |
|
|
|
('ctrl', 'ctrl'), |
|
|
@ -122,6 +128,22 @@ class Document(models.Model): |
|
|
|
return Comment.objects.filter(document=self.id).count() |
|
|
|
|
|
|
|
|
|
|
|
class Image(models.Model): |
|
|
|
project = models.ForeignKey(Project, related_name='images', on_delete=models.CASCADE) |
|
|
|
meta = models.JSONField(default=dict) |
|
|
|
filename = models.FilePathField(default='') |
|
|
|
created_at = models.DateTimeField(auto_now_add=True) |
|
|
|
updated_at = models.DateTimeField(auto_now=True) |
|
|
|
annotations_approved_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True) |
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
return self.filename |
|
|
|
|
|
|
|
@property |
|
|
|
def comment_count(self): |
|
|
|
return Comment.objects.count() |
|
|
|
|
|
|
|
|
|
|
|
class Comment(models.Model): |
|
|
|
text = models.TextField() |
|
|
|
document = models.ForeignKey(Document, related_name='comments', on_delete=models.CASCADE) |
|
|
@ -203,6 +225,14 @@ class Speech2textAnnotation(Annotation): |
|
|
|
unique_together = ('document', 'user') |
|
|
|
|
|
|
|
|
|
|
|
class ImageCategoryLabel(Annotation): |
|
|
|
image = models.ForeignKey(Image, related_name='categories', on_delete=models.CASCADE) |
|
|
|
label = models.ForeignKey(Label, on_delete=models.CASCADE) |
|
|
|
|
|
|
|
class Meta: |
|
|
|
unique_together = ('image', 'user', 'label') |
|
|
|
|
|
|
|
|
|
|
|
class Role(models.Model): |
|
|
|
name = models.CharField(max_length=100, unique=True) |
|
|
|
description = models.TextField(default='') |
|
|
|