gpt4 book ai didi

speech-recognition - 408 请求超时 Microsoft Speech to Text

转载 作者:行者123 更新时间:2023-12-04 07:55:49 27 4
gpt4 key购买 nike

我的 .wav 文件长度只有 4 秒。即使在多次重试并在云端运行后,我仍然不断收到以下错误

  * upload completely sent off: 12 out of 12 bytes
< HTTP/1.1 408 Request timed out (> 14000 ms)
< Transfer-Encoding: chunked
< Content-Type: text/plain
< Server: Microsoft-IIS/8.5
< X-MSEdge-Ref:

有人遇到过这个问题吗?这是我的要求

  `curl -v "https://speech.platform.bing.com/recognize?
scenarios=catsearch&appid=D4D52672-91D7-4C74-8AD8-42B1D98141A5&locale=en-
US&device.os=wp7&version=3.0&format=json&requestid=1d4b6030-9099-12e0-91e4-
0800200c9a67&instanceid=1d4b6030-9099-12e0-91e5-0800200c9a68" -H
"Authorization: Bearer $1" -H "Content-Type: audio/wav; samplerate=8000" --
data-binary $2`

最佳答案

我在让它工作时也遇到了一些问题。以下 BASH 脚本“bingrec.sh”可能有助于使其更加清晰;输入您的 SUBSCRIPTION_KEY 并根据需要调整 SAMPLERATE 等。正如其他人指出的那样,需要将区域设置和场景设置为支持的值,并且 instance_id 和 request_id 需要采用 GUID 格式。音频文件长度应少于 10 秒,采样率为 8000 或 16000。此外,curl“--data-binary”参数需要在音频文件名前加一个“@”。

#!/bin/bash
# Usage: ./bingrec.sh /path/to/file
# Send audio file $1 through Bing speech recognition API.
#
SUBSCRIPTION_KEY=<your-key-here>
LOCALE=en-US
SCENARIOS=ulm
SAMPLERATE=8000
CODEC=audio/pcm

TARGET_FILE=$1
if [ ! -f "$TARGET_FILE" ]; then
echo Error: file $TARGET_FILE does not exist!
exit 1
fi

INSTANCE_ID=`uuidgen` # random GUID for instance
REQUEST_ID=`uuidgen` # random GUID for request
APPID=D4D52672-91D7-4C74-8AD8-42B1D98141A5 # APPID for Bing Speechrec API, don't change
DEVICE_OS=linux # arbitraty
FORMAT=json

AUTH_TOKEN=`curl -v -X POST "https://api.cognitive.microsoft.com/sts/v1.0/issueToken" -H "Content-type: application/x-www-form-urlencoded" -H "Content-Length: 0" -H "Ocp-Apim-Subscription-Key: ${SUBSCRIPTION_KEY}"`

curl -v -X POST "https://speech.platform.bing.com/recognize?scenarios=${SCENARIOS}&appid=${APPID}&locale=${LOCALE}&device.os=${DEVICE_OS}&version=3.0&format=${FORMAT}&instanceid=${INSTANCE_ID}&requestid=${REQUEST_ID}" -H "Authorization: Bearer ${AUTH_TOKEN}" -H "Content-type: audio/wav; codec='${CODEC}'; samplerate=${SAMPLERATE}" --data-binary @${TARGET_FILE}

关于speech-recognition - 408 请求超时 Microsoft Speech to Text,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38139809/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com