Created
May 18, 2019 14:27
-
-
Save ei-grad/447bd0c867ed73d8e29e598c01e7555a to your computer and use it in GitHub Desktop.
speech2text command using Yandex SpeachKit
This file contains 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 | |
if [ -z "$YC_API_KEY" ]; then | |
cat << EOF | |
Yandex Cloud API Key is needed: | |
https://cloud.yandex.ru/docs/iam/concepts/authorization/api-key | |
it would require some hustle with service account and roles: | |
https://cloud.yandex.ru/docs/speechkit/security/ | |
You can also adjust this script to use the token-based auth, if you like. | |
Contributions are welcome. | |
EOF | |
exit 1 | |
fi | |
curl \ | |
-X POST \ | |
-v \ | |
-H "Transfer-Encoding: chunked" \ | |
-H "Content-Type: audio/ogg" \ | |
-H "Authorization: Api-Key $YC_API_KEY" \ | |
--data-binary @<(rec -twav - silence 1 0.1 3% 1 1.0 3% | opusenc - -) \ | |
'https://stt.api.cloud.yandex.net/speech/v1/stt:recognize?topic=general' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment