Browse Source

Update upload factory

pull/1370/head
Hironsan 3 years ago
parent
commit
8e1cb87f40
1 changed files with 6 additions and 3 deletions
  1. 9
      backend/api/views/upload/factory.py

9
backend/api/views/upload/factory.py

@ -1,4 +1,5 @@
from ...models import DOCUMENT_CLASSIFICATION, SEQ2SEQ, SEQUENCE_LABELING
from ...models import (DOCUMENT_CLASSIFICATION, IMAGE_CLASSIFICATION, SEQ2SEQ,
SEQUENCE_LABELING)
from . import catalog, data, dataset, label
@ -19,7 +20,8 @@ def get_dataset_class(format: str):
catalog.JSON.name: dataset.JSONDataset,
catalog.FastText.name: dataset.FastTextDataset,
catalog.Excel.name: dataset.ExcelDataset,
catalog.CoNLL.name: dataset.CoNLLDataset
catalog.CoNLL.name: dataset.CoNLLDataset,
catalog.ImageFile.name: dataset.FileBaseDataset,
}
if format not in mapping:
ValueError(f'Invalid format: {format}')
@ -30,7 +32,8 @@ def get_label_class(project_type: str):
mapping = {
DOCUMENT_CLASSIFICATION: label.CategoryLabel,
SEQUENCE_LABELING: label.OffsetLabel,
SEQ2SEQ: label.TextLabel
SEQ2SEQ: label.TextLabel,
IMAGE_CLASSIFICATION: label.CategoryLabel,
}
if project_type not in mapping:
ValueError(f'Invalid project type: {project_type}')

Loading…
Cancel
Save