diff --git a/backend/api/views/upload/catalog.py b/backend/api/views/upload/catalog.py index 82e91029..57b89d8c 100644 --- a/backend/api/views/upload/catalog.py +++ b/backend/api/views/upload/catalog.py @@ -5,7 +5,7 @@ from pydantic import BaseModel from typing_extensions import Literal from ...models import (DOCUMENT_CLASSIFICATION, IMAGE_CLASSIFICATION, SEQ2SEQ, - SEQUENCE_LABELING) + SEQUENCE_LABELING, SPEECH2TEXT) from . import examples encodings = Literal[ @@ -168,6 +168,11 @@ class ImageFile(Format): accept_types = 'image/png, image/jpeg, image/bmp, image/gif' +class AudioFile(Format): + name = 'AudioFile' + accept_types = 'audio/ogg, audio/aac, audio/mpeg, audio/wav' + + class OptionColumn(BaseModel): encoding: encodings = 'utf_8' column_data: str = 'text' @@ -241,3 +246,6 @@ Options.register(SEQ2SEQ, Excel, OptionColumn, examples.Text_CSV) # Image classification Options.register(IMAGE_CLASSIFICATION, ImageFile, OptionNone, examples.Generic_ImageFile) + +# Speech to Text +Options.register(SPEECH2TEXT, AudioFile, OptionNone, examples.Generic_AudioFile) diff --git a/backend/api/views/upload/examples.py b/backend/api/views/upload/examples.py index 0b738252..1dbc337c 100644 --- a/backend/api/views/upload/examples.py +++ b/backend/api/views/upload/examples.py @@ -10,6 +10,12 @@ Generic_ImageFile = """ └── 202104210945.png """ +Generic_AudioFile = """ +├── 202104210943.mp3 +├── 202104210944.mp3 +└── 202104210945.mp3 +""" + Generic_TextLine = """ Terrible customer service. Really great transaction.