-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
48 lines (39 loc) · 1.21 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pydantic import BaseModel
class SpeechTranscribeRequest(BaseModel):
"""
Defines the input schema for the /transcribe endpoint.
It requires a file path.
"""
file: str
class SpeechTranscribeResponse(BaseModel):
"""
Defines the output schema for the /transcribe endpoint.
It returns the transcription of the input audio file.
"""
transcript: str
class TextTranslateRequest(BaseModel):
"""
Defines the input schema for the /translate endpoint.
It requires text to be translated and a target language.
"""
text: str
target_language: str
class TextTranslateResponse(BaseModel):
"""
Defines the output schema for the /translate endpoint.
It returns the translated text in the target language.
"""
translated_text: str
class SpeechTranslateRequest(BaseModel):
"""
Defines the input schema for the /translate_speech endpoint.
It requires an audio file path and a target language.
"""
file: str
target_language: str
class SpeechTranslateResponse(BaseModel):
"""
Defines the output schema for the /translate_speech endpoint.
It returns the translated text in the target language.
"""
translated_text: str