【问题标题】:IBM Speech to text api , unable to make a HTTP POST callIBM Speech to text api,无法进行 HTTP POST 调用
【发布时间】:2015-07-13 16:19:18
【问题描述】:

我正在制作一个 python 程序,它应该发送一个小的 .wav 音频剪辑并获得响应,我已经尝试了几件事,但直到现在我都无法发出成功的请求

更多细节: https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/speech-to-text/recognizeSessionless

那些已经尝试过这个平台的人

【问题讨论】:

    标签: python http post speech-to-text


    【解决方案1】:

    请尝试以下代码:

    import requests
    
    url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/recognize'
    username = '<username>'
    password = '<password>'
    
    headers={'Content-Type': 'audio/wav'}
    
    audio = open('./sheet.wav', 'rb')
    
    r = requests.post(url, data=audio, headers=headers, auth=(username, password))
    
    print(r.text)
    

    【讨论】:

    • 谢谢老兄,我在您回答之前找到了可行的解决方案,所以没有尝试您的解决方案。链接:github.com/williamanaryan/watson-wpeech-to-text-python
    • 您好,这些天,IBM 云不提供用户名和密码,但他们提供特定位置的 IAM 密钥和 url。
    猜你喜欢
    • 2017-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多