Created
November 13, 2018 18:31
-
-
Save mmmaly/e78fbc3d05cb232e38e6cee5cda6aa2d to your computer and use it in GitHub Desktop.
Call Google speech recognize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fileogg=$1 | |
name=${fileogg%.ogg} | |
file=$name.flac | |
ffmpeg -i $fileogg -ar 16000 $file 2>/dev/null | |
gsutil cp $file gs://transcribe | |
gcloud ml speech recognize-long-running gs://transcribe/$file --sample-rate 16000 --encoding flac --language-code='sk-SK' --async > $$.id | |
id=`jq -r .name < $$.id ` | |
gcloud ml speech operations wait $id > $name.json | |
jq -r .results[0].alternatives[0].transcript < $name.json | tee $name.txt | |
rm $$.id | |
rm $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment