-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathresponses.py
95 lines (92 loc) · 2.74 KB
/
responses.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
SUCCESSFUL_RESPONSE = {
"description": "Successful Response",
"content": {
"application/json": {
"example": {
"filename": "example.mp3",
"detected_language": "en",
"language_probability": 0.9,
"text": "This is an example transcription.",
"segments": [
{
"text": "This is an example",
"start": 0.0,
"end": 1.5,
"words": [
{
"word": "This",
"start": 0.0,
"end": 0.2
},
{
"word": "is",
"start": 0.2,
"end": 0.3
},
{
"word": "an",
"start": 0.3,
"end": 0.5
},
{
"word": "example",
"start": 0.5,
"end": 1.0
}
]
},
{
"text": "transcription.",
"start": 1.5,
"end": 2.0
}
]
}
}
}
}
BAD_REQUEST_RESPONSE = {
"description": "Bad Request",
"content": {
"application/json": {
"example": {
"error": {
"message": "Invalid language. Supported languages are: af, am, ar, ...",
"type": "HTTPException",
"param": "",
"code": 400
}
}
}
}
}
VALIDATION_ERROR_RESPONSE = {
"description": "Validation Error",
"content": {
"application/json": {
"example": {
"error": {
"message": "Field required",
"type": "invalid_request_error",
"param": "files",
"code": 422
}
}
}
}
}
INTERNAL_SERVER_ERROR_RESPONSE = {
"description": "Internal Server Error",
"content": {
"application/json": {
"example": {
"error": {
"message": "An unexpected error occurred.",
"type": "Exception",
"param": "",
"code": 500
}
}
}
}
}