Browse Source

Add upload catalog for speech to text

pull/1395/head
Hironsan 3 years ago
parent
commit
dc2fd90061
2 changed files with 15 additions and 1 deletions
  1. 10
      backend/api/views/upload/catalog.py
  2. 6
      backend/api/views/upload/examples.py

10
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)

6
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.

Loading…
Cancel
Save