Santipab commited on
Commit
5763f06
·
verified ·
1 Parent(s): c136704

Upload 5 files

Browse files
PartiiService_pb2.py ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: PartiiService.proto
4
+ """Generated protocol buffer code."""
5
+ from google.protobuf.internal import enum_type_wrapper
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import message as _message
9
+ from google.protobuf import reflection as _reflection
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ # @@protoc_insertion_point(imports)
12
+
13
+ _sym_db = _symbol_database.Default()
14
+
15
+
16
+
17
+
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13PartiiService.proto\x12\x06partii\"\x17\n\x04Word\x12\x0f\n\x07wordstr\x18\x01 \x01(\t\"-\n\nWordResult\x12\x0e\n\x06wordid\x18\x01 \x01(\x03\x12\x0f\n\x07wordstr\x18\x02 \x01(\t\"\n\n\x08\x45mptyMsg\"(\n\x13\x41vailableConnection\x12\x11\n\tAvailable\x18\x01 \x01(\x03\" \n\x0b\x42uildNumber\x12\x11\n\tBuildDate\x18\x01 \x01(\t\"Q\n\x08\x41uthData\x12\x0e\n\x06\x41piKey\x18\x01 \x01(\t\x12\x14\n\x0cSamplingRate\x18\x02 \x01(\x03\x12\x10\n\x08\x43lientID\x18\x03 \x01(\t\x12\r\n\x05\x43odec\x18\x04 \x01(\x03\"E\n\nAuthStatus\x12\x0f\n\x07Message\x18\x01 \x01(\t\x12&\n\nAuthStatus\x18\x02 \x01(\x0e\x32\x12.partii.StatusCode\"X\n\tAudioData\x12\x11\n\tByteChunk\x18\x01 \x01(\x0c\x12\x0f\n\x07\x42ytelen\x18\x02 \x01(\x03\x12\'\n\x08\x44\x61tatype\x18\x03 \x01(\x0e\x32\x15.partii.AudioDataType\"\x8b\x01\n\nWordsLevel\x12\x0c\n\x04word\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x11\n\tstartTime\x18\x03 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x04 \x01(\x02\x12\x12\n\nwordNumber\x18\x05 \x01(\x03\x12#\n\x06phones\x18\x06 \x03(\x0b\x32\x13.partii.PhonesLevel\"i\n\x0bPhonesLevel\x12\r\n\x05phone\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x11\n\tstartTime\x18\x03 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x04 \x01(\x02\x12\x13\n\x0bphoneNumber\x18\x05 \x01(\x03\"\xba\x02\n\x13TranscriptionResult\x12\x12\n\ntranscript\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x11\n\tstartTime\x18\x03 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x04 \x01(\x02\x12\x16\n\x0esentenceNumber\x18\x05 \x01(\x03\x12(\n\x0csentenceType\x18\x06 \x01(\x0e\x32\x12.partii.ResultType\x12!\n\x05words\x18\x07 \x03(\x0b\x32\x12.partii.WordsLevel\x12&\n\x07\x65motion\x18\x08 \x01(\x0b\x32\x15.partii.EmotionResult\x12&\n\x07speaker\x18\t \x01(\x0b\x32\x15.partii.SpeakerResult\x12\"\n\x06Status\x18\n \x01(\x0e\x32\x12.partii.StatusCode\"\xaa\x01\n\rSpeakerResult\x12\x11\n\tspeakerID\x18\x01 \x01(\x03\x12\x11\n\tstartTime\x18\x02 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x03 \x01(\x02\x12\x15\n\rspeakerNumber\x18\x04 \x01(\x03\x12\'\n\x0bspeakerType\x18\x05 \x01(\x0e\x32\x12.partii.ResultType\x12\"\n\x06Status\x18\x06 \x01(\x0e\x32\x12.partii.StatusCode\"\xe5\x01\n\rEmotionResult\x12\x0f\n\x07\x65motion\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x11\n\tstartTime\x18\x03 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x04 \x01(\x02\x12\x15\n\remotionNumber\x18\x05 \x01(\x03\x12\'\n\x0bsegmentType\x18\x06 \x01(\x0e\x32\x12.partii.ResultType\x12\'\n\x0bsubemotions\x18\x07 \x03(\x0b\x32\x12.partii.SubEmotion\x12\"\n\x06Status\x18\x08 \x01(\x0e\x32\x12.partii.StatusCode\"l\n\nSubEmotion\x12\x0f\n\x07\x65motion\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x11\n\tstartTime\x18\x03 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x04 \x01(\x02\x12\x15\n\remotionNumber\x18\x05 \x01(\x03\"X\n\x07VADProb\x12\x0f\n\x07\x66rameid\x18\x01 \x01(\x03\x12\x13\n\x0bprobability\x18\x02 \x01(\x02\x12\'\n\x08\x64\x61tatype\x18\x03 \x01(\x0e\x32\x15.partii.AudioDataType\"n\n\x12\x43\x61librateVadResult\x12\x14\n\x0cvadthreshold\x18\x01 \x01(\x02\x12\x1e\n\x05probs\x18\x02 \x03(\x0b\x32\x0f.partii.VADProb\x12\"\n\x06Status\x18\x03 \x01(\x0e\x32\x12.partii.StatusCode\"\xbc\x01\n\x0eWakeWordResult\x12\x0c\n\x04word\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x11\n\tstartTime\x18\x03 \x01(\x02\x12\x0f\n\x07\x65ndTime\x18\x04 \x01(\x02\x12\x16\n\x0ewakewordNumber\x18\x05 \x01(\x03\x12(\n\x0csentenceType\x18\x06 \x01(\x0e\x32\x12.partii.ResultType\x12\"\n\x06Status\x18\x07 \x01(\x0e\x32\x12.partii.StatusCode\"\xda\x01\n\x1eWakeWordAndTranscriptionResult\x12/\n\ntranscript\x18\x01 \x01(\x0b\x32\x1b.partii.TranscriptionResult\x12(\n\x08wakeword\x18\x02 \x01(\x0b\x32\x16.partii.WakeWordResult\x12&\n\nresulttype\x18\x03 \x01(\x0e\x32\x12.partii.ResultType\x12\"\n\x06Status\x18\x04 \x01(\x0e\x32\x12.partii.StatusCode\x12\x11\n\tstatusmsg\x18\x05 \x01(\t*f\n\nAudioCodec\x12\x0c\n\x08LINEAR16\x10\x00\x12\t\n\x05SPEEX\x10\x01\x12\x08\n\x04\x46LAC\x10\x02\x12\x07\n\x03MP3\x10\x03\x12\t\n\x05MULAW\x10\x04\x12\x07\n\x03\x41MR\x10\x05\x12\n\n\x06\x41MR_WB\x10\x06\x12\x0c\n\x08OGG_OPUS\x10\x07*Q\n\nResultType\x12\x0b\n\x07PARTIAL\x10\x00\x12\n\n\x06RESULT\x10\x01\x12\x0c\n\x08\x46INISHED\x10\x02\x12\x0c\n\x08WAKEWORD\x10\x03\x12\x0e\n\nTRANSCRIPT\x10\x04*8\n\rAudioDataType\x12\n\n\x06SPEECH\x10\x00\x12\r\n\tNONSPEECH\x10\x01\x12\x0c\n\x08\x45NDPOINT\x10\x02*-\n\nStatusCode\x12\x0b\n\x07Unknown\x10\x00\x12\x06\n\x02Ok\x10\x01\x12\n\n\x06\x46\x61iled\x10\x02\x32\x9d\x02\n\rTranscription\x12H\n\x10SingleTranscribe\x12\x11.partii.AudioData\x1a\x1b.partii.TranscriptionResult\"\x00(\x01\x30\x01\x12\x46\n\x0eLiveTranscribe\x12\x11.partii.AudioData\x1a\x1b.partii.TranscriptionResult\"\x00(\x01\x30\x01\x12?\n\x0cGetAvailable\x12\x10.partii.EmptyMsg\x1a\x1b.partii.AvailableConnection\"\x00\x12\x39\n\x0eGetBuildNumber\x12\x10.partii.EmptyMsg\x1a\x13.partii.BuildNumber\"\x00\x42\r\n\x0bpartii.grpcb\x06proto3')
19
+
20
+ _AUDIOCODEC = DESCRIPTOR.enum_types_by_name['AudioCodec']
21
+ AudioCodec = enum_type_wrapper.EnumTypeWrapper(_AUDIOCODEC)
22
+ _RESULTTYPE = DESCRIPTOR.enum_types_by_name['ResultType']
23
+ ResultType = enum_type_wrapper.EnumTypeWrapper(_RESULTTYPE)
24
+ _AUDIODATATYPE = DESCRIPTOR.enum_types_by_name['AudioDataType']
25
+ AudioDataType = enum_type_wrapper.EnumTypeWrapper(_AUDIODATATYPE)
26
+ _STATUSCODE = DESCRIPTOR.enum_types_by_name['StatusCode']
27
+ StatusCode = enum_type_wrapper.EnumTypeWrapper(_STATUSCODE)
28
+ LINEAR16 = 0
29
+ SPEEX = 1
30
+ FLAC = 2
31
+ MP3 = 3
32
+ MULAW = 4
33
+ AMR = 5
34
+ AMR_WB = 6
35
+ OGG_OPUS = 7
36
+ PARTIAL = 0
37
+ RESULT = 1
38
+ FINISHED = 2
39
+ WAKEWORD = 3
40
+ TRANSCRIPT = 4
41
+ SPEECH = 0
42
+ NONSPEECH = 1
43
+ ENDPOINT = 2
44
+ Unknown = 0
45
+ Ok = 1
46
+ Failed = 2
47
+
48
+
49
+ _WORD = DESCRIPTOR.message_types_by_name['Word']
50
+ _WORDRESULT = DESCRIPTOR.message_types_by_name['WordResult']
51
+ _EMPTYMSG = DESCRIPTOR.message_types_by_name['EmptyMsg']
52
+ _AVAILABLECONNECTION = DESCRIPTOR.message_types_by_name['AvailableConnection']
53
+ _BUILDNUMBER = DESCRIPTOR.message_types_by_name['BuildNumber']
54
+ _AUTHDATA = DESCRIPTOR.message_types_by_name['AuthData']
55
+ _AUTHSTATUS = DESCRIPTOR.message_types_by_name['AuthStatus']
56
+ _AUDIODATA = DESCRIPTOR.message_types_by_name['AudioData']
57
+ _WORDSLEVEL = DESCRIPTOR.message_types_by_name['WordsLevel']
58
+ _PHONESLEVEL = DESCRIPTOR.message_types_by_name['PhonesLevel']
59
+ _TRANSCRIPTIONRESULT = DESCRIPTOR.message_types_by_name['TranscriptionResult']
60
+ _SPEAKERRESULT = DESCRIPTOR.message_types_by_name['SpeakerResult']
61
+ _EMOTIONRESULT = DESCRIPTOR.message_types_by_name['EmotionResult']
62
+ _SUBEMOTION = DESCRIPTOR.message_types_by_name['SubEmotion']
63
+ _VADPROB = DESCRIPTOR.message_types_by_name['VADProb']
64
+ _CALIBRATEVADRESULT = DESCRIPTOR.message_types_by_name['CalibrateVadResult']
65
+ _WAKEWORDRESULT = DESCRIPTOR.message_types_by_name['WakeWordResult']
66
+ _WAKEWORDANDTRANSCRIPTIONRESULT = DESCRIPTOR.message_types_by_name['WakeWordAndTranscriptionResult']
67
+ Word = _reflection.GeneratedProtocolMessageType('Word', (_message.Message,), {
68
+ 'DESCRIPTOR' : _WORD,
69
+ '__module__' : 'PartiiService_pb2'
70
+ # @@protoc_insertion_point(class_scope:partii.Word)
71
+ })
72
+ _sym_db.RegisterMessage(Word)
73
+
74
+ WordResult = _reflection.GeneratedProtocolMessageType('WordResult', (_message.Message,), {
75
+ 'DESCRIPTOR' : _WORDRESULT,
76
+ '__module__' : 'PartiiService_pb2'
77
+ # @@protoc_insertion_point(class_scope:partii.WordResult)
78
+ })
79
+ _sym_db.RegisterMessage(WordResult)
80
+
81
+ EmptyMsg = _reflection.GeneratedProtocolMessageType('EmptyMsg', (_message.Message,), {
82
+ 'DESCRIPTOR' : _EMPTYMSG,
83
+ '__module__' : 'PartiiService_pb2'
84
+ # @@protoc_insertion_point(class_scope:partii.EmptyMsg)
85
+ })
86
+ _sym_db.RegisterMessage(EmptyMsg)
87
+
88
+ AvailableConnection = _reflection.GeneratedProtocolMessageType('AvailableConnection', (_message.Message,), {
89
+ 'DESCRIPTOR' : _AVAILABLECONNECTION,
90
+ '__module__' : 'PartiiService_pb2'
91
+ # @@protoc_insertion_point(class_scope:partii.AvailableConnection)
92
+ })
93
+ _sym_db.RegisterMessage(AvailableConnection)
94
+
95
+ BuildNumber = _reflection.GeneratedProtocolMessageType('BuildNumber', (_message.Message,), {
96
+ 'DESCRIPTOR' : _BUILDNUMBER,
97
+ '__module__' : 'PartiiService_pb2'
98
+ # @@protoc_insertion_point(class_scope:partii.BuildNumber)
99
+ })
100
+ _sym_db.RegisterMessage(BuildNumber)
101
+
102
+ AuthData = _reflection.GeneratedProtocolMessageType('AuthData', (_message.Message,), {
103
+ 'DESCRIPTOR' : _AUTHDATA,
104
+ '__module__' : 'PartiiService_pb2'
105
+ # @@protoc_insertion_point(class_scope:partii.AuthData)
106
+ })
107
+ _sym_db.RegisterMessage(AuthData)
108
+
109
+ AuthStatus = _reflection.GeneratedProtocolMessageType('AuthStatus', (_message.Message,), {
110
+ 'DESCRIPTOR' : _AUTHSTATUS,
111
+ '__module__' : 'PartiiService_pb2'
112
+ # @@protoc_insertion_point(class_scope:partii.AuthStatus)
113
+ })
114
+ _sym_db.RegisterMessage(AuthStatus)
115
+
116
+ AudioData = _reflection.GeneratedProtocolMessageType('AudioData', (_message.Message,), {
117
+ 'DESCRIPTOR' : _AUDIODATA,
118
+ '__module__' : 'PartiiService_pb2'
119
+ # @@protoc_insertion_point(class_scope:partii.AudioData)
120
+ })
121
+ _sym_db.RegisterMessage(AudioData)
122
+
123
+ WordsLevel = _reflection.GeneratedProtocolMessageType('WordsLevel', (_message.Message,), {
124
+ 'DESCRIPTOR' : _WORDSLEVEL,
125
+ '__module__' : 'PartiiService_pb2'
126
+ # @@protoc_insertion_point(class_scope:partii.WordsLevel)
127
+ })
128
+ _sym_db.RegisterMessage(WordsLevel)
129
+
130
+ PhonesLevel = _reflection.GeneratedProtocolMessageType('PhonesLevel', (_message.Message,), {
131
+ 'DESCRIPTOR' : _PHONESLEVEL,
132
+ '__module__' : 'PartiiService_pb2'
133
+ # @@protoc_insertion_point(class_scope:partii.PhonesLevel)
134
+ })
135
+ _sym_db.RegisterMessage(PhonesLevel)
136
+
137
+ TranscriptionResult = _reflection.GeneratedProtocolMessageType('TranscriptionResult', (_message.Message,), {
138
+ 'DESCRIPTOR' : _TRANSCRIPTIONRESULT,
139
+ '__module__' : 'PartiiService_pb2'
140
+ # @@protoc_insertion_point(class_scope:partii.TranscriptionResult)
141
+ })
142
+ _sym_db.RegisterMessage(TranscriptionResult)
143
+
144
+ SpeakerResult = _reflection.GeneratedProtocolMessageType('SpeakerResult', (_message.Message,), {
145
+ 'DESCRIPTOR' : _SPEAKERRESULT,
146
+ '__module__' : 'PartiiService_pb2'
147
+ # @@protoc_insertion_point(class_scope:partii.SpeakerResult)
148
+ })
149
+ _sym_db.RegisterMessage(SpeakerResult)
150
+
151
+ EmotionResult = _reflection.GeneratedProtocolMessageType('EmotionResult', (_message.Message,), {
152
+ 'DESCRIPTOR' : _EMOTIONRESULT,
153
+ '__module__' : 'PartiiService_pb2'
154
+ # @@protoc_insertion_point(class_scope:partii.EmotionResult)
155
+ })
156
+ _sym_db.RegisterMessage(EmotionResult)
157
+
158
+ SubEmotion = _reflection.GeneratedProtocolMessageType('SubEmotion', (_message.Message,), {
159
+ 'DESCRIPTOR' : _SUBEMOTION,
160
+ '__module__' : 'PartiiService_pb2'
161
+ # @@protoc_insertion_point(class_scope:partii.SubEmotion)
162
+ })
163
+ _sym_db.RegisterMessage(SubEmotion)
164
+
165
+ VADProb = _reflection.GeneratedProtocolMessageType('VADProb', (_message.Message,), {
166
+ 'DESCRIPTOR' : _VADPROB,
167
+ '__module__' : 'PartiiService_pb2'
168
+ # @@protoc_insertion_point(class_scope:partii.VADProb)
169
+ })
170
+ _sym_db.RegisterMessage(VADProb)
171
+
172
+ CalibrateVadResult = _reflection.GeneratedProtocolMessageType('CalibrateVadResult', (_message.Message,), {
173
+ 'DESCRIPTOR' : _CALIBRATEVADRESULT,
174
+ '__module__' : 'PartiiService_pb2'
175
+ # @@protoc_insertion_point(class_scope:partii.CalibrateVadResult)
176
+ })
177
+ _sym_db.RegisterMessage(CalibrateVadResult)
178
+
179
+ WakeWordResult = _reflection.GeneratedProtocolMessageType('WakeWordResult', (_message.Message,), {
180
+ 'DESCRIPTOR' : _WAKEWORDRESULT,
181
+ '__module__' : 'PartiiService_pb2'
182
+ # @@protoc_insertion_point(class_scope:partii.WakeWordResult)
183
+ })
184
+ _sym_db.RegisterMessage(WakeWordResult)
185
+
186
+ WakeWordAndTranscriptionResult = _reflection.GeneratedProtocolMessageType('WakeWordAndTranscriptionResult', (_message.Message,), {
187
+ 'DESCRIPTOR' : _WAKEWORDANDTRANSCRIPTIONRESULT,
188
+ '__module__' : 'PartiiService_pb2'
189
+ # @@protoc_insertion_point(class_scope:partii.WakeWordAndTranscriptionResult)
190
+ })
191
+ _sym_db.RegisterMessage(WakeWordAndTranscriptionResult)
192
+
193
+ _TRANSCRIPTION = DESCRIPTOR.services_by_name['Transcription']
194
+ if _descriptor._USE_C_DESCRIPTORS == False:
195
+
196
+ DESCRIPTOR._options = None
197
+ DESCRIPTOR._serialized_options = b'\n\013partii.grpc'
198
+ _AUDIOCODEC._serialized_start=2130
199
+ _AUDIOCODEC._serialized_end=2232
200
+ _RESULTTYPE._serialized_start=2234
201
+ _RESULTTYPE._serialized_end=2315
202
+ _AUDIODATATYPE._serialized_start=2317
203
+ _AUDIODATATYPE._serialized_end=2373
204
+ _STATUSCODE._serialized_start=2375
205
+ _STATUSCODE._serialized_end=2420
206
+ _WORD._serialized_start=31
207
+ _WORD._serialized_end=54
208
+ _WORDRESULT._serialized_start=56
209
+ _WORDRESULT._serialized_end=101
210
+ _EMPTYMSG._serialized_start=103
211
+ _EMPTYMSG._serialized_end=113
212
+ _AVAILABLECONNECTION._serialized_start=115
213
+ _AVAILABLECONNECTION._serialized_end=155
214
+ _BUILDNUMBER._serialized_start=157
215
+ _BUILDNUMBER._serialized_end=189
216
+ _AUTHDATA._serialized_start=191
217
+ _AUTHDATA._serialized_end=272
218
+ _AUTHSTATUS._serialized_start=274
219
+ _AUTHSTATUS._serialized_end=343
220
+ _AUDIODATA._serialized_start=345
221
+ _AUDIODATA._serialized_end=433
222
+ _WORDSLEVEL._serialized_start=436
223
+ _WORDSLEVEL._serialized_end=575
224
+ _PHONESLEVEL._serialized_start=577
225
+ _PHONESLEVEL._serialized_end=682
226
+ _TRANSCRIPTIONRESULT._serialized_start=685
227
+ _TRANSCRIPTIONRESULT._serialized_end=999
228
+ _SPEAKERRESULT._serialized_start=1002
229
+ _SPEAKERRESULT._serialized_end=1172
230
+ _EMOTIONRESULT._serialized_start=1175
231
+ _EMOTIONRESULT._serialized_end=1404
232
+ _SUBEMOTION._serialized_start=1406
233
+ _SUBEMOTION._serialized_end=1514
234
+ _VADPROB._serialized_start=1516
235
+ _VADPROB._serialized_end=1604
236
+ _CALIBRATEVADRESULT._serialized_start=1606
237
+ _CALIBRATEVADRESULT._serialized_end=1716
238
+ _WAKEWORDRESULT._serialized_start=1719
239
+ _WAKEWORDRESULT._serialized_end=1907
240
+ _WAKEWORDANDTRANSCRIPTIONRESULT._serialized_start=1910
241
+ _WAKEWORDANDTRANSCRIPTIONRESULT._serialized_end=2128
242
+ _TRANSCRIPTION._serialized_start=2423
243
+ _TRANSCRIPTION._serialized_end=2708
244
+ # @@protoc_insertion_point(module_scope)
PartiiService_pb2_grpc.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+
5
+ import PartiiService_pb2 as PartiiService__pb2
6
+
7
+
8
+ class TranscriptionStub(object):
9
+ """Missing associated documentation comment in .proto file."""
10
+
11
+ def __init__(self, channel):
12
+ """Constructor.
13
+
14
+ Args:
15
+ channel: A grpc.Channel.
16
+ """
17
+ self.SingleTranscribe = channel.stream_stream(
18
+ '/partii.Transcription/SingleTranscribe',
19
+ request_serializer=PartiiService__pb2.AudioData.SerializeToString,
20
+ response_deserializer=PartiiService__pb2.TranscriptionResult.FromString,
21
+ )
22
+ self.LiveTranscribe = channel.stream_stream(
23
+ '/partii.Transcription/LiveTranscribe',
24
+ request_serializer=PartiiService__pb2.AudioData.SerializeToString,
25
+ response_deserializer=PartiiService__pb2.TranscriptionResult.FromString,
26
+ )
27
+ self.GetAvailable = channel.unary_unary(
28
+ '/partii.Transcription/GetAvailable',
29
+ request_serializer=PartiiService__pb2.EmptyMsg.SerializeToString,
30
+ response_deserializer=PartiiService__pb2.AvailableConnection.FromString,
31
+ )
32
+ self.GetBuildNumber = channel.unary_unary(
33
+ '/partii.Transcription/GetBuildNumber',
34
+ request_serializer=PartiiService__pb2.EmptyMsg.SerializeToString,
35
+ response_deserializer=PartiiService__pb2.BuildNumber.FromString,
36
+ )
37
+
38
+
39
+ class TranscriptionServicer(object):
40
+ """Missing associated documentation comment in .proto file."""
41
+
42
+ def SingleTranscribe(self, request_iterator, context):
43
+ """Missing associated documentation comment in .proto file."""
44
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
45
+ context.set_details('Method not implemented!')
46
+ raise NotImplementedError('Method not implemented!')
47
+
48
+ def LiveTranscribe(self, request_iterator, context):
49
+ """Missing associated documentation comment in .proto file."""
50
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
51
+ context.set_details('Method not implemented!')
52
+ raise NotImplementedError('Method not implemented!')
53
+
54
+ def GetAvailable(self, request, context):
55
+ """Missing associated documentation comment in .proto file."""
56
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
57
+ context.set_details('Method not implemented!')
58
+ raise NotImplementedError('Method not implemented!')
59
+
60
+ def GetBuildNumber(self, request, context):
61
+ """Missing associated documentation comment in .proto file."""
62
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
63
+ context.set_details('Method not implemented!')
64
+ raise NotImplementedError('Method not implemented!')
65
+
66
+
67
+ def add_TranscriptionServicer_to_server(servicer, server):
68
+ rpc_method_handlers = {
69
+ 'SingleTranscribe': grpc.stream_stream_rpc_method_handler(
70
+ servicer.SingleTranscribe,
71
+ request_deserializer=PartiiService__pb2.AudioData.FromString,
72
+ response_serializer=PartiiService__pb2.TranscriptionResult.SerializeToString,
73
+ ),
74
+ 'LiveTranscribe': grpc.stream_stream_rpc_method_handler(
75
+ servicer.LiveTranscribe,
76
+ request_deserializer=PartiiService__pb2.AudioData.FromString,
77
+ response_serializer=PartiiService__pb2.TranscriptionResult.SerializeToString,
78
+ ),
79
+ 'GetAvailable': grpc.unary_unary_rpc_method_handler(
80
+ servicer.GetAvailable,
81
+ request_deserializer=PartiiService__pb2.EmptyMsg.FromString,
82
+ response_serializer=PartiiService__pb2.AvailableConnection.SerializeToString,
83
+ ),
84
+ 'GetBuildNumber': grpc.unary_unary_rpc_method_handler(
85
+ servicer.GetBuildNumber,
86
+ request_deserializer=PartiiService__pb2.EmptyMsg.FromString,
87
+ response_serializer=PartiiService__pb2.BuildNumber.SerializeToString,
88
+ ),
89
+ }
90
+ generic_handler = grpc.method_handlers_generic_handler(
91
+ 'partii.Transcription', rpc_method_handlers)
92
+ server.add_generic_rpc_handlers((generic_handler,))
93
+
94
+
95
+ # This class is part of an EXPERIMENTAL API.
96
+ class Transcription(object):
97
+ """Missing associated documentation comment in .proto file."""
98
+
99
+ @staticmethod
100
+ def SingleTranscribe(request_iterator,
101
+ target,
102
+ options=(),
103
+ channel_credentials=None,
104
+ call_credentials=None,
105
+ insecure=False,
106
+ compression=None,
107
+ wait_for_ready=None,
108
+ timeout=None,
109
+ metadata=None):
110
+ return grpc.experimental.stream_stream(request_iterator, target, '/partii.Transcription/SingleTranscribe',
111
+ PartiiService__pb2.AudioData.SerializeToString,
112
+ PartiiService__pb2.TranscriptionResult.FromString,
113
+ options, channel_credentials,
114
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
115
+
116
+ @staticmethod
117
+ def LiveTranscribe(request_iterator,
118
+ target,
119
+ options=(),
120
+ channel_credentials=None,
121
+ call_credentials=None,
122
+ insecure=False,
123
+ compression=None,
124
+ wait_for_ready=None,
125
+ timeout=None,
126
+ metadata=None):
127
+ return grpc.experimental.stream_stream(request_iterator, target, '/partii.Transcription/LiveTranscribe',
128
+ PartiiService__pb2.AudioData.SerializeToString,
129
+ PartiiService__pb2.TranscriptionResult.FromString,
130
+ options, channel_credentials,
131
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
132
+
133
+ @staticmethod
134
+ def GetAvailable(request,
135
+ target,
136
+ options=(),
137
+ channel_credentials=None,
138
+ call_credentials=None,
139
+ insecure=False,
140
+ compression=None,
141
+ wait_for_ready=None,
142
+ timeout=None,
143
+ metadata=None):
144
+ return grpc.experimental.unary_unary(request, target, '/partii.Transcription/GetAvailable',
145
+ PartiiService__pb2.EmptyMsg.SerializeToString,
146
+ PartiiService__pb2.AvailableConnection.FromString,
147
+ options, channel_credentials,
148
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
149
+
150
+ @staticmethod
151
+ def GetBuildNumber(request,
152
+ target,
153
+ options=(),
154
+ channel_credentials=None,
155
+ call_credentials=None,
156
+ insecure=False,
157
+ compression=None,
158
+ wait_for_ready=None,
159
+ timeout=None,
160
+ metadata=None):
161
+ return grpc.experimental.unary_unary(request, target, '/partii.Transcription/GetBuildNumber',
162
+ PartiiService__pb2.EmptyMsg.SerializeToString,
163
+ PartiiService__pb2.BuildNumber.FromString,
164
+ options, channel_credentials,
165
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
config.ini ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [DEFAULT]
2
+ _server_ip = partii.aiforthai.in.th
3
+ _server_port = 27020
4
+ _audio_sampling_rate = 16000
5
+ _chunk_len_second = 0.5
6
+ _audio_codec = LINEAR16
7
+ _api_key = xxxxxx
8
+ _client_id = Python-Mac
9
+ _verbose = 1
10
+ _vad_threshold = 0.5
11
+ _num_channels = 1
12
+ _decode_chanel = 0
13
+ _model_key = default
14
+ _protocol = partii
15
+ _enable_textnorm = true
16
+ _enable_partial = true
17
+ _enable_vad = true
18
+ _enable_endpoint = true
19
+ _number_target = english
20
+ _view = sentent
21
+
22
+ [SERVER]
23
+ _server_port = 27020
24
+
partii-client-process-wav-file.py ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+
5
+ import configparser
6
+ import time
7
+ import grpc
8
+ import PartiiService_pb2_grpc
9
+ import PartiiService_pb2
10
+ import wave
11
+ import numpy as np
12
+ import sys
13
+
14
+ _SERVER_IP = "127.0.0.1"
15
+ _SERVER_PORT = 27021
16
+ _AUDIO_INPUT = ""
17
+ _AUDIO_SAMPLE_RATE = 16000
18
+ _AUDIO_CODEC = "LINEAR16"
19
+ _PACKAGE_SIZE = 1024
20
+ _CHUNK_LEN_SECONE = 0.2
21
+ _VERBOSE = 0
22
+
23
+ _API_KEY = ""
24
+ _CLIENT_ID = "web-R75PbQuF"
25
+
26
+ _VAD_THRESHOLD = 0.5
27
+ _NUM_CHANNELS = 1
28
+ _DECODE_CHANEL = 0
29
+ _MODEL_KEY = "default"
30
+ _PROTOCOL = "partii"
31
+ _ENABLE_TEXTNORM = "true"
32
+ _ENABLE_PARTIAL = "true"
33
+ _ENABLE_VAD = "true"
34
+ _ENABLE_ENDPOINT = "true"
35
+ _NUMBER_TARGET = "english"
36
+ _VIEW = "sentent"
37
+
38
+ def convMilliFormat(millis):
39
+ time = (float(millis) * 1000);
40
+ mil = time % 1000;
41
+ sec = (time / 1000) % 60;
42
+ minute = (time / (1000 * 60)) % 60;
43
+ hour = (time / (1000 * 60 * 60)) % 24;
44
+ return "{:02d}:{:02d}:{:02d},{:03d}".format(int(hour), int(minute), int(sec), int(mil));
45
+
46
+
47
+ def readwave(fname):
48
+ obj = wave.open(fname,'r')
49
+ if _VERBOSE != "0" :
50
+ print( "Number of channels",obj.getnchannels())
51
+ print ( "Sample width",obj.getsampwidth())
52
+ print ( "Frame rate.",obj.getframerate())
53
+ print ( "Number of frames",obj.getnframes())
54
+ print ( "parameters:",obj.getparams())
55
+
56
+ for i in range(0, obj.getnframes(), int(_PACKAGE_SIZE)):
57
+ waveData = obj.readframes(int(_PACKAGE_SIZE))
58
+ yield PartiiService_pb2.AudioData(ByteChunk=waveData, Bytelen=len(waveData), Datatype=PartiiService_pb2.AudioDataType.SPEECH)
59
+ obj.close()
60
+
61
+
62
+ def GetAvailable():
63
+ available = 0
64
+ channel = grpc.insecure_channel('{}:{}'.format(_SERVER_IP, _SERVER_PORT))
65
+ stub = PartiiService_pb2_grpc.TranscriptionStub(channel)
66
+ metadata = (
67
+ ('apikey', str(_API_KEY)),
68
+ ('client-id', str(_CLIENT_ID)),
69
+ ('modelkey', str(_MODEL_KEY)),
70
+ ('protocol', str(_PROTOCOL))
71
+ )
72
+ response = stub.GetAvailable(PartiiService_pb2.EmptyMsg(), metadata=metadata)
73
+ available = response.Available
74
+ return available
75
+
76
+ def run():
77
+
78
+ retries = 1
79
+ timeout = 3
80
+
81
+ while retries > 0:
82
+
83
+ if GetAvailable() > 0 :
84
+ if _VERBOSE != "0" :
85
+ print("Start : ",_AUDIO_INPUT )
86
+ print('{}:{}'.format(_SERVER_IP, _SERVER_PORT))
87
+
88
+ with grpc.insecure_channel('{}:{}'.format(_SERVER_IP, _SERVER_PORT)) as channel:
89
+ stub = PartiiService_pb2_grpc.TranscriptionStub(channel)
90
+
91
+ metadata = (
92
+ ('apikey', str(_API_KEY)),
93
+ ('sampling-rate', str(_AUDIO_SAMPLING_RATE)),
94
+ ('client-id', str(_CLIENT_ID)),
95
+ ('vad-threshold', str(_VAD_THRESHOLD)),
96
+ ('num-channels', str(_NUM_CHANNELS)),
97
+ ('decode-channels', str(_DECODE_CHANEL)),
98
+ ('modelkey', str(_MODEL_KEY)),
99
+ ('audio-codec', str(_AUDIO_CODEC)),
100
+ ('protocol', str(_PROTOCOL)),
101
+ ('enable-textnorm', str(_ENABLE_TEXTNORM)),
102
+ ('enable-partial', str(_ENABLE_PARTIAL)),
103
+ ('enable-vad', str(_ENABLE_VAD)),
104
+ ('enable-endpoint', str(_ENABLE_ENDPOINT)),
105
+ ('number-target', str(_NUMBER_TARGET))
106
+ )
107
+
108
+ if _VERBOSE != "0" :
109
+ print(metadata)
110
+
111
+ rawbyte_list = readwave(_AUDIO_INPUT)
112
+
113
+ responses = stub.LiveTranscribe(rawbyte_list, metadata=metadata)
114
+
115
+ try:
116
+ for response in responses:
117
+ if(response.Status == PartiiService_pb2.StatusCode.Ok):
118
+ if(response.sentenceType == PartiiService_pb2.ResultType.PARTIAL):
119
+ if _VERBOSE != "0" :
120
+ print("sentenceNumber %s " %(response.sentenceNumber))
121
+ print("transcript %s " %(response.transcript))
122
+ print("confidence %s " %(response.confidence))
123
+ print("startTime %s, %s " %(response.startTime, convMilliFormat(response.startTime)))
124
+ print("endTime %s, %s " %(response.endTime, convMilliFormat(response.endTime)))
125
+
126
+ elif(response.sentenceType == PartiiService_pb2.ResultType.RESULT):
127
+ if _VIEW == "sentent" :
128
+ print("sentenceNumber %s " %(response.sentenceNumber))
129
+ print("transcript %s " %(response.transcript))
130
+ print("confidence %s " %(response.confidence))
131
+ print("startTime %s " %(response.startTime))
132
+ print("endTime %s " %(response.endTime))
133
+
134
+ if _VIEW == "word" :
135
+ for w in response.words:
136
+ print("\twordNumber %s " %(w.wordNumber))
137
+ print("\tword %s " %(w.word))
138
+ print("\tconfidence %s " %(w.confidence))
139
+ print("\tstartTime %s " %(w.startTime))
140
+ print("\tendTime %s " %(w.endTime))
141
+
142
+ if _VIEW == "phone" :
143
+ for w in response.words:
144
+ for p in w.phones:
145
+ print("\t\tphoneNumber %s " %(p.phoneNumber))
146
+ print("\t\tphone %s " %(p.phone))
147
+ print("\t\tconfidence %s " %(p.confidence))
148
+ print("\t\tstartTime %s " %(p.startTime))
149
+ print("\t\tendTime %s " %(p.endTime))
150
+
151
+ elif(response.sentenceType == PartiiService_pb2.ResultType.FINISHED):
152
+
153
+ if _VERBOSE != "0" :
154
+ print("Last respond from server [%s] " %(response.transcript))
155
+ print("Stop : ", _AUDIO_INPUT)
156
+
157
+ retries = 0
158
+ break
159
+
160
+ elif(response.Status == PartiiService_pb2.StatusCode.Failed):
161
+ print("ERROR [%s] " %(response.transcript))
162
+ print('Waiting for %s seconds'%(timeout))
163
+ time.sleep(timeout)
164
+ retries -= 1
165
+
166
+ except:
167
+ print("An exception occurred")
168
+ print('Waiting for %s seconds'%(timeout))
169
+ time.sleep(timeout)
170
+ retries -= 1
171
+
172
+ else:
173
+
174
+ print('Waiting for %s seconds'%(timeout))
175
+ time.sleep(timeout)
176
+ retries -= 1
177
+
178
+ if __name__ == '__main__':
179
+ start_time = time.time()
180
+ config = configparser.ConfigParser()
181
+ config.read('config.ini')
182
+
183
+ _SERVER_IP = config['DEFAULT']['_SERVER_IP']
184
+ _SERVER_PORT = int(config['DEFAULT']['_SERVER_PORT'])
185
+ _AUDIO_INPUT = sys.argv[1]
186
+ _AUDIO_SAMPLING_RATE = int(config['DEFAULT']['_AUDIO_SAMPLING_RATE'])
187
+ _AUDIO_CODEC = config['DEFAULT']['_AUDIO_CODEC']
188
+ _CHUNK_LEN_SECONE = config['DEFAULT']['_CHUNK_LEN_SECOND']
189
+ _VERBOSE = config['DEFAULT']['_VERBOSE']
190
+
191
+ _PACKAGE_SIZE = float(_CHUNK_LEN_SECONE) * float(_AUDIO_SAMPLE_RATE) * 2
192
+ _API_KEY = sys.argv[2]
193
+ _CLIENT_ID = config['DEFAULT']['_CLIENT_ID']
194
+
195
+ _VAD_THRESHOLD = config['DEFAULT']['_VAD_THRESHOLD']
196
+ _NUM_CHANNELS = config['DEFAULT']['_NUM_CHANNELS']
197
+ _DECODE_CHANEL = config['DEFAULT']['_DECODE_CHANEL']
198
+ _MODEL_KEY = config['DEFAULT']['_MODEL_KEY']
199
+ _PROTOCOL = config['DEFAULT']['_PROTOCOL']
200
+ _ENABLE_TEXTNORM = config['DEFAULT']['_ENABLE_TEXTNORM']
201
+ _ENABLE_PARTIAL = config['DEFAULT']['_ENABLE_PARTIAL']
202
+ _ENABLE_VAD = config['DEFAULT']['_ENABLE_VAD']
203
+ _ENABLE_ENDPOINT = config['DEFAULT']['_ENABLE_ENDPOINT']
204
+ _NUMBER_TARGET = config['DEFAULT']['_NUMBER_TARGET']
205
+ _VIEW = config['DEFAULT']['_VIEW']
206
+
207
+ run()
208
+
209
+ end_time = time.time()
210
+ print("Runtime of the program is ", (end_time - start_time))
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ aift==1.1.0
2
+ grpcio==1.67.1
3
+ numpy==2.1.3
4
+ protobuf==5.28.3
5
+ PyAudio==0.2.13
6
+ pydub==0.25.1
7
+ Requests==2.32.3
8
+ six==1.16.0
9
+ streamlit==1.40.0
10
+ ~treamlit==1.37.1