gRPC is a cross-platform open source high performance Remote Procedure Call framework. gRPC was initially created by Google. We can stream voice speech directly from any microphone to our ASR engine and our gRPC ASR service will response back the transcription automatically when the silence period (about 1.5 seconds) is detected.
This service is not yet openly available. If you are interested, please contact for endpoint information at ai@iapp.co.th
from__future__import print_functionimport grpcimport ASR_pb2_grpc as ASR_pb2_grpcimport ASR_pb2 as pb2import sysdefmake_SpeechRecognitionRequest(voice):return pb2.SpeechRecognitionRequest( speechVoice=voice )defgenerate_voices():withopen('kaitomm.mp3', 'rb')as fd: content = fd.read() requests = [make_SpeechRecognitionRequest(content),make_SpeechRecognitionRequest(content),make_SpeechRecognitionRequest(content) ]for request in requests:print("Hello Server Sending voiceStreaming to you with size %d"%len(request.speechVoice))yield requestdeftest(stub,message):""" Client function to call the rpc for GetServerResponse """ message = pb2.SpeechRecognitionMessage(message=message)print(f'Sending Message: {message}', file=sys.stderr)return stub.test(message)defasr_voice_streaming(stub): responses = stub.recognize(generate_voices())print(responses, file=sys.stderr)for response in responses:print(type(response))print("Hello from the server received your %s"% response, file=sys.stderr)defrun():# Please contact ai@iapp.co.th for gRPC HOST address.with grpc.insecure_channel('{gRPC HOST}')as channel: stub = ASR_pb2_grpc.ASRStub(channel) resp =test(stub, "Hello World!")print(resp.message)asr_voice_streaming(stub)if__name__=='__main__':run()