First install the packages we need from requirements.txt
brew install portaudio
pip3 install -r requirements.txt
** NOTES: if you have problems on this step, with error:
fatal error: 'portaudio.h' file not found
** you need to run this first:
brew install portaudio
Perform streaming speech transcription on an audio file
python3 streaming.py --file audio/get_tts_audio_test.wav
Perform streaming speech transcription on an audio file with training and punctuation
python3 streaming.py --file audio/get_tts_audio_test.wav --enable_automatic_punctuation true
Perform streaming speech transcription on an audio file with speech hints(context) and punctuation
python3 streaming.py --file audio/get_tts_audio_test.wav --enable_automatic_punctuation true --speech_hints "voicea,cisco"
To specify engine and language code:
python3 streaming.py --file audio/get_tts_audio_test.wav --engine google --language_code en-US
python3 streaming.py --file audio/30min.raw --engine nutcracker --language_code en-US
Now the language code can be en-US. It only takes the first 2 letters.
python3 streaming.py --engine capri --language_code en-US
Perform async longrunning speech transcription on an audio url (using the default sample)
python3 streaming.py --longrunning true
Perform async longrunning speech transcription on an audio url and specify the url
python3 streaming.py --longrunning true --url https://www.ee.columbia.edu/~dpwe/sounds/mr/spkr0.wav
Perform async longrunning speech transcription with particular config key on an audio url and specify the url
python3 streaming.py --longrunning true --url https://www.ee.columbia.edu/~dpwe/sounds/mr/spkr0.wav --config_key_name voicemailk2
Perform async longrunning speech transcription on an audio file (only for short audio)
python3 streaming.py --longrunning true --file audio/get_tts_audio_test.wav
Perform async longrunning speech transcription with particular config key on an audio file (only for short audio)
python3 streaming.py --longrunning true --file audio/get_tts_audio_test.wav --config_key_name voicemailk2
Perform async longrunning speech transcription on an audio file (only for short audio) with language detection enabled
python3 streaming.py --longrunning true --file audio/get_tts_audio_test.wav --expected_language_codes en,es,fr
Perform async longrunning speech transcription with CSI file. Audio and CSI files uploaded using pre-signed URLs in the code.
python3 streaming.py --file audio/30min_csi.wav --csi_file audio/csi.json --recording_upload true --language en
If the proto file is change, please run the following command to update generated code to reflect the changes
protoc --proto_path=./ --python_out=./ speech.proto
To regenerate speech_pb2_grpc.py, you need run the following:
python -m pip install grpcio
python -m pip install grpcio-tools
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. speech.proto