This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
yandex_speechkit [2019/11/20 12:54] val [Выполняется для учетной записи, а не для процесса] |
yandex_speechkit [2022/06/23 12:05] val [В первый раз] |
||
---|---|---|---|
Line 21: | Line 21: | ||
* [[https://oauth.yandex.ru/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb|Получить OAuth token]] | * [[https://oauth.yandex.ru/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb|Получить OAuth token]] | ||
- | ==== Выполняется для учетной записи, а не для процесса ==== | + | * !!! Выполняется для учетной записи, а не для процесса |
- | <code> | ||
- | $ source .bashrc | ||
- | </code> | ||
==== В первый раз ==== | ==== В первый раз ==== | ||
<code> | <code> | ||
- | $ yc init | + | $ $HOME/yandex-cloud/bin/yc init |
Welcome! This command will take you through the configuration process. | Welcome! This command will take you through the configuration process. | ||
Please go to https://oauth.yandex.ru/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb in order to obtain OAuth token. | Please go to https://oauth.yandex.ru/authorize?response_type=token&client_id=1a6990aa636648e9b2ef855fa7bec2fb in order to obtain OAuth token. | ||
- | Please enter OAuth token: A.......................................k | + | Please enter OAuth token: AgAAAAA5aXjoAATuwTc4tOJXokpGsOqgIlk1NYI |
... | ... | ||
Please choose folder to use: | Please choose folder to use: | ||
- | [1] default (id = b1gmpublpjhm23dm8nfk) | + | [1] default (id = b1gg4j6ru4esprat3uu7) |
- | ... | + | ... 1 |
+ | ... n | ||
</code> | </code> | ||
==== После "Выйти на всех устройствах" ==== | ==== После "Выйти на всех устройствах" ==== | ||
<code> | <code> | ||
- | $ yc config set token A.....................................k | + | $ $HOME/yandex-cloud/bin/yc config set token A............................................I |
- | $ yc config list | + | $ $HOME/yandex-cloud/bin/yc config list |
</code> | </code> | ||
===== Проверка распознавания речи ===== | ===== Проверка распознавания речи ===== | ||
- | |||
- | * [[http://val.bmstu.ru/unix/Media/speech.ogg]] | ||
<code> | <code> | ||
- | $ export IAM_TOKEN=`yc iam create-token` | + | $ wget http://val.bmstu.ru/unix/Media/speech.ogg |
+ | или | ||
+ | $ mv -v /usr/share/asterisk/sounds/recordings/speech.ogg . | ||
+ | |||
+ | $ IAM_TOKEN=`$HOME/yandex-cloud/bin/yc iam create-token` | ||
- | $ export FOLDER_ID=b1gmpublpjhm23dm8nfk | + | $ FOLDER_ID=b1gg4j6ru4esprat3uu7 |
- | $ curl -s -X POST \ | + | $ curl -s -X POST -H "Authorization: Bearer ${IAM_TOKEN}" --data-binary "@speech.ogg" \ |
- | -H "Authorization: Bearer ${IAM_TOKEN}" \ | + | "https://stt.api.cloud.yandex.net/speech/v1/stt:recognize?folderId=${FOLDER_ID}" \ |
- | --data-binary "@speech.ogg" \ | + | | jq '.result' | tr -d '"' |
- | "https://stt.api.cloud.yandex.net/speech/v1/stt:recognize?folderId=${FOLDER_ID}" | jq '.result' | tr -d '"' | + | |
</code> | </code> |