@ -11,7 +11,7 @@ def create_repository(project) -> repositories.BaseRepository:
SEQUENCE_LABELING: repositories.SequenceLabelingRepository,
SEQ2SEQ: repositories.Seq2seqRepository,
IMAGE_CLASSIFICATION: repositories.FileRepository,
SPEECH2TEXT: repositories.FileRepository,
SPEECH2TEXT: repositories.Speech2TextRepository,
}
if project.project_type not in mapping:
ValueError(f'Invalid project type: {project.project_type}')
@ -62,6 +62,15 @@ class FileRepository(BaseRepository):
return {'all': value}
class Speech2TextRepository(FileRepository):
def label_per_user(self, example) -> Dict:
label_per_user = defaultdict(list)
for a in example.texts.all():
label_per_user[a.user.username].append(a.text)
return label_per_user
class TextRepository(BaseRepository):
@property