maleo-transcription 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maleo_transcription/__init__.py +0 -0
- maleo_transcription/constants.py +15 -0
- maleo_transcription/enums.py +9 -0
- maleo_transcription/models/__init__.py +0 -0
- maleo_transcription/models/responses.py +17 -0
- maleo_transcription/models/schemas.py +45 -0
- maleo_transcription/models/transfers/__init__.py +0 -0
- maleo_transcription/models/transfers/general.py +47 -0
- maleo_transcription/models/transfers/parameters.py +13 -0
- maleo_transcription/models/transfers/results.py +19 -0
- maleo_transcription/types/__init__.py +0 -0
- maleo_transcription/types/results.py +8 -0
- maleo_transcription-0.0.2.dist-info/METADATA +39 -0
- maleo_transcription-0.0.2.dist-info/RECORD +16 -0
- maleo_transcription-0.0.2.dist-info/WHEEL +5 -0
- maleo_transcription-0.0.2.dist-info/top_level.txt +1 -0
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class MaleoTranscriptionConstants:
|
2
|
+
MIME_FORMAT_MAP:dict[str, str] = {
|
3
|
+
"audio/aac": "aac",
|
4
|
+
"audio/flac": "flac",
|
5
|
+
"audio/ogg": "ogg",
|
6
|
+
"audio/x-hx-aac-adts": "aac",
|
7
|
+
"audio/mpeg": "mp3",
|
8
|
+
"audio/mp4": "m4a",
|
9
|
+
"audio/x-m4a": "m4a",
|
10
|
+
"audio/wav": "wav",
|
11
|
+
"audio/x-wav": "wav",
|
12
|
+
"audio/webm": "webm",
|
13
|
+
"video/webm": "webm",
|
14
|
+
"video/mp4": "m4a",
|
15
|
+
}
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from pydantic import Field
|
2
|
+
from typing import Optional
|
3
|
+
from maleo_foundation.models.responses import BaseResponses
|
4
|
+
from maleo_transcription.models.transfers.general import TranscribeTransfers
|
5
|
+
from maleo_transcription.models.transfers.results import ResultMetadata
|
6
|
+
|
7
|
+
class MaleoTranscriptionResponses:
|
8
|
+
class TranscribeFailed(BaseResponses.BadRequest):
|
9
|
+
code:str = "TRN-SCB-002"
|
10
|
+
message:str = "Failed transcribing audio"
|
11
|
+
|
12
|
+
class TranscribeSuccess(BaseResponses.SingleData):
|
13
|
+
code:str = "TRN-SCB-003"
|
14
|
+
message:str = "Successfully transcribed audio"
|
15
|
+
description:str = "The given audio has been successfully transcribed"
|
16
|
+
data:TranscribeTransfers = Field(..., description="Single transcribe data")
|
17
|
+
metadata:Optional[ResultMetadata] = Field(None, description="Optional metadata")
|
@@ -0,0 +1,45 @@
|
|
1
|
+
from fastapi import UploadFile
|
2
|
+
from pydantic import BaseModel, Field
|
3
|
+
from typing import Optional, List
|
4
|
+
from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
|
5
|
+
from maleo_transcription.enums import MaleoTranscriptionEnums
|
6
|
+
|
7
|
+
class MaleoTranscriptionSchemas:
|
8
|
+
class Expand(BaseParameterSchemas.Expand):
|
9
|
+
expand:Optional[List[MaleoTranscriptionEnums.ExpandableFields]] = Field(None, description="Expanded Fields")
|
10
|
+
|
11
|
+
class Language(BaseModel):
|
12
|
+
language:MaleoTranscriptionEnums.Languange = Field(MaleoTranscriptionEnums.Languange.ID, description="Audio language")
|
13
|
+
|
14
|
+
class AudioFile(BaseModel):
|
15
|
+
audio:UploadFile = Field(..., description="Audio File")
|
16
|
+
|
17
|
+
class Name(BaseModel):
|
18
|
+
name:str = Field(..., description="Audio file name")
|
19
|
+
|
20
|
+
class Size(BaseModel):
|
21
|
+
size:int = Field(..., ge=0, description="Audio file size")
|
22
|
+
|
23
|
+
class MimeType(BaseModel):
|
24
|
+
mime_type:str = Field(..., description="Audio file mime type")
|
25
|
+
|
26
|
+
class Format(BaseModel):
|
27
|
+
format:str = Field(..., description="Audio file format")
|
28
|
+
|
29
|
+
class AudioData(BaseModel):
|
30
|
+
data:bytes = Field(..., description="Audio data")
|
31
|
+
|
32
|
+
class Duration(BaseModel):
|
33
|
+
duration:float = Field(0, description="Audio Duration")
|
34
|
+
|
35
|
+
class Channels(BaseModel):
|
36
|
+
channels:int = Field(..., description="WAV Audio Number of Channels")
|
37
|
+
|
38
|
+
class SampleWidth(BaseModel):
|
39
|
+
sample_width:int = Field(..., description="WAV Audio Sample Width")
|
40
|
+
|
41
|
+
class FrameRate(BaseModel):
|
42
|
+
frame_rate:int = Field(..., description="WAV Audio Frame Rate")
|
43
|
+
|
44
|
+
class NumberOfFrames(BaseModel):
|
45
|
+
number_of_frames:int = Field(..., description="WAV Audio Number of Frames")
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from pydantic import BaseModel, Field, model_validator
|
2
|
+
from typing import List, Optional, Self, Tuple
|
3
|
+
from maleo_transcription.models.schemas import MaleoTranscriptionSchemas
|
4
|
+
|
5
|
+
class OriginalAudioPropertiesTransfers(
|
6
|
+
MaleoTranscriptionSchemas.Format,
|
7
|
+
MaleoTranscriptionSchemas.MimeType,
|
8
|
+
MaleoTranscriptionSchemas.Size,
|
9
|
+
MaleoTranscriptionSchemas.Name
|
10
|
+
): pass
|
11
|
+
|
12
|
+
class OriginalAudioTransfers(
|
13
|
+
MaleoTranscriptionSchemas.AudioData,
|
14
|
+
OriginalAudioPropertiesTransfers
|
15
|
+
): pass
|
16
|
+
|
17
|
+
class ConvertedAudioPropertiesTransfers(
|
18
|
+
MaleoTranscriptionSchemas.Size,
|
19
|
+
MaleoTranscriptionSchemas.Duration,
|
20
|
+
MaleoTranscriptionSchemas.NumberOfFrames,
|
21
|
+
MaleoTranscriptionSchemas.FrameRate,
|
22
|
+
MaleoTranscriptionSchemas.SampleWidth,
|
23
|
+
MaleoTranscriptionSchemas.Channels
|
24
|
+
):
|
25
|
+
@model_validator(mode="after")
|
26
|
+
def calculate_duration(self) -> Self:
|
27
|
+
if self.frame_rate == 0:
|
28
|
+
self.duration = 0
|
29
|
+
else:
|
30
|
+
self.duration = self.number_of_frames/self.frame_rate
|
31
|
+
|
32
|
+
return self
|
33
|
+
|
34
|
+
class AudioPropertiesTransfers(BaseModel):
|
35
|
+
original:OriginalAudioPropertiesTransfers = Field(..., description="Original audio properties")
|
36
|
+
converted:Optional[ConvertedAudioPropertiesTransfers] = Field(None, description="Converted audio properties")
|
37
|
+
|
38
|
+
class TranscribePropertiesTransfers(BaseModel):
|
39
|
+
duration:float = Field(..., description="Transcribe duration")
|
40
|
+
|
41
|
+
class TranscribeChunk(BaseModel):
|
42
|
+
timestamp:Tuple[float, float] = Field(..., description="Timestamp")
|
43
|
+
text:str = Field(..., description="Text")
|
44
|
+
|
45
|
+
class TranscribeTransfers(BaseModel):
|
46
|
+
text:str = Field(..., description="Transcribe text")
|
47
|
+
chunks:List[TranscribeChunk] = Field(..., description="List of transcribe chunk")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from pydantic import Field
|
2
|
+
from maleo_transcription.models.schemas import MaleoTranscriptionSchemas
|
3
|
+
from maleo_transcription.models.transfers.general import OriginalAudioTransfers
|
4
|
+
|
5
|
+
class MaleoTranscriptionParametersTransfers:
|
6
|
+
class TranscribeController(
|
7
|
+
MaleoTranscriptionSchemas.Expand,
|
8
|
+
MaleoTranscriptionSchemas.AudioFile,
|
9
|
+
MaleoTranscriptionSchemas.Language
|
10
|
+
): pass
|
11
|
+
|
12
|
+
class TranscribeService(MaleoTranscriptionSchemas.Language):
|
13
|
+
audio:OriginalAudioTransfers = Field(..., description="Original audio")
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from pydantic import BaseModel, Field
|
2
|
+
from typing import Optional
|
3
|
+
from maleo_foundation.models.schemas.result import BaseResultSchemas
|
4
|
+
from maleo_transcription.models.transfers.general import (
|
5
|
+
AudioPropertiesTransfers,
|
6
|
+
TranscribePropertiesTransfers,
|
7
|
+
TranscribeTransfers
|
8
|
+
)
|
9
|
+
|
10
|
+
class ResultMetadata(BaseModel):
|
11
|
+
audio:AudioPropertiesTransfers = Field(..., description="Audio Properties")
|
12
|
+
transcribe:TranscribePropertiesTransfers = Field(..., description="Transcribe Properties")
|
13
|
+
|
14
|
+
class MaleoTranscriptionResultsTransfers:
|
15
|
+
class Fail(BaseResultSchemas.Fail): pass
|
16
|
+
|
17
|
+
class SingleData(BaseResultSchemas.SingleData):
|
18
|
+
data:TranscribeTransfers = Field(..., description="Single transcribe data")
|
19
|
+
metadata:Optional[ResultMetadata] = Field(None, description="Optional metadata")
|
File without changes
|
@@ -0,0 +1,8 @@
|
|
1
|
+
from typing import Union
|
2
|
+
from maleo_transcription.models.transfers.results import MaleoTranscriptionResultsTransfers
|
3
|
+
|
4
|
+
class MaleoTranscriptionResultsTypes:
|
5
|
+
Transcribe = Union[
|
6
|
+
MaleoTranscriptionResultsTransfers.Fail,
|
7
|
+
MaleoTranscriptionResultsTransfers.SingleData
|
8
|
+
]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: maleo-transcription
|
3
|
+
Version: 0.0.2
|
4
|
+
Summary: MaleoTranscription service package
|
5
|
+
Author-email: Agra Bima Yuda <agra@nexmedis.com>
|
6
|
+
License: MIT
|
7
|
+
Requires-Python: >=3.7
|
8
|
+
Description-Content-Type: text/markdown
|
9
|
+
Requires-Dist: maleo_foundation>=0.2.96
|
10
|
+
|
11
|
+
# README #
|
12
|
+
|
13
|
+
This README would normally document whatever steps are necessary to get your application up and running.
|
14
|
+
|
15
|
+
### What is this repository for? ###
|
16
|
+
|
17
|
+
* Quick summary
|
18
|
+
* Version
|
19
|
+
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
20
|
+
|
21
|
+
### How do I get set up? ###
|
22
|
+
|
23
|
+
* Summary of set up
|
24
|
+
* Configuration
|
25
|
+
* Dependencies
|
26
|
+
* Database configuration
|
27
|
+
* How to run tests
|
28
|
+
* Deployment instructions
|
29
|
+
|
30
|
+
### Contribution guidelines ###
|
31
|
+
|
32
|
+
* Writing tests
|
33
|
+
* Code review
|
34
|
+
* Other guidelines
|
35
|
+
|
36
|
+
### Who do I talk to? ###
|
37
|
+
|
38
|
+
* Repo owner or admin
|
39
|
+
* Other community or team contact
|
@@ -0,0 +1,16 @@
|
|
1
|
+
maleo_transcription/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
maleo_transcription/constants.py,sha256=NEFH_cNyHTbSy9F2W24CJ2WtgpLrGVwwMGWUzkLEj0M,436
|
3
|
+
maleo_transcription/enums.py,sha256=Vir0hsRqZiJDccA2_XFXccU864RKoqCsR_INAigasjI,186
|
4
|
+
maleo_transcription/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
maleo_transcription/models/responses.py,sha256=hLrEENwNp8NZlQmvCEJj-zO1iOf7kvcWPuZ90YhGjGo,831
|
6
|
+
maleo_transcription/models/schemas.py,sha256=e1gSwrI5atVNvMguHc5vxEFUjFfkTLoTszBUezh2K5E,1710
|
7
|
+
maleo_transcription/models/transfers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
maleo_transcription/models/transfers/general.py,sha256=BdwmvvXwndvHxoHcKZ1QA9HG-KY4i2YXPtyJDsTz1os,1729
|
9
|
+
maleo_transcription/models/transfers/parameters.py,sha256=M7UwfyZpWqlHeslAeaPfxSi4JQ41OU6vfnv89Vk8m8s,545
|
10
|
+
maleo_transcription/models/transfers/results.py,sha256=GsOtjJ1SgMfiYElmsHsLLMIZ_PV9BCQhYUOGz5ZKhYQ,807
|
11
|
+
maleo_transcription/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
maleo_transcription/types/results.py,sha256=IbFK8eEnFcFaaawKQB520OLJ74CXHuj_Ut7K8yHwDcc,288
|
13
|
+
maleo_transcription-0.0.2.dist-info/METADATA,sha256=2cNIGVR5P_mvjepgbgpfaAHVWjZ7YYrT80eHcZak-WI,839
|
14
|
+
maleo_transcription-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
maleo_transcription-0.0.2.dist-info/top_level.txt,sha256=9cOFwWoRLVG2oQ2NSG_S87pWNxj2BaFCKYZr-_KHZYM,20
|
16
|
+
maleo_transcription-0.0.2.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
maleo_transcription
|