小智 5

嗨,问题出在授权中,需要在授权选项卡下提供 API 密钥,我建议通过 IBM 控制台交叉检查 API 密钥

以下是使用 IBM watson 和 postman 将文本转换为语音的步骤

  1. 我假设你有 ApiKey 值,如果你没有 Go to, IBM watson, create text-to-speech resource, -> Go to Manage -> You will have the API Key IBM 控制台
  2. 转到 Postman,创建新的 Post 请求
  3. 现在您需要添加 URL、使用基本方法授权、标题和数据引用 授权 标题 数据/正文

单击“发送”,您将在“响应”->“正文”选项卡下收到音频

如果你想快速检查,那么你可以使用 curl 来做同样的事情

 curl -X POST \
    https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize \
      -H 'Accept: audio/wav' \
      -H 'Authorization: Basic REPLACE_API_KEY' \
      -H 'Content-Type: application/json' \
      -H 'Postman-Token: 3c147726-2f1e-4531-abca-0898127e8644' \
      -H 'cache-control: no-cache' \
      -d '{"text": "hello world"}'
Run Code Online (Sandbox Code Playgroud)