WebSocket升级失败,使用azure.cognitiveservices.speech的错误请求(400)

时间:2020-02-27 17:00:44

标签: azure speech-to-text azure-cognitive-services

我使用Microsoft的语音转文本服务的任何方法都无法使我出错:

Speech Recognition canceled: CancellationReason.Error
Error details: WebSocket Upgrade failed with a bad request (400). Please check the language name and endpoint id (if used) are correctly associated with the provided subscription key.

我已经使用这个库好几天了,它从无处不在开始给我这个问题。访问数据正确。我唯一了解的是,仅当我使用以下两种方法之一时,问题才会出现:

speech_config.speech_recognition_language = "en_EN"
speech_config.endpoint_id = "my_endpoint_uri"

有人遇到我自己的问题并且知道如何解决吗? 预先感谢大家。

1 个答案:

答案 0 :(得分:0)

在文档here中查看受支持的语言列表。

英语有几种语言环境,但没有EN。您应根据需要使用en-USen-GB(或另一个)。

对于endpoint_id字段,如果您不使用“自定义”语音,则应为空;如果您使用自己的自定义语音,则应具有部署ID。