alittletrain
V2EX  ›  问与答

百度语音 REST-API 问题

  •  
  •   alittletrain · Aug 25, 2016 · 2279 views
    This topic created in 3725 days ago, the information mentioned may be changed or developed.

    识别 rest_api 上传语音数据返回 3300 不管是直接上传语音文件还是使用 base64 方式,都返回 3300 ,求 V 神帮忙。。

    3 replies  •  2016-08-25 10:04:20 +08:00
    xia0chun
    xia0chun
    Aug 25, 2016
    1
    3300 是输入参数不正确
    请参考官方格式再试一遍
    http://yuyin.baidu.com/docs/asr/57
    alittletrain
    alittletrain
    OP
    Aug 25, 2016
    2
    @xia0chun 已经试了 NNN 次了。。
    alittletrain
    alittletrain
    OP
    Aug 25, 2016
    3
    @xia0chun 能不能给帮忙看看?

    def baidu_input(voice):
    r = requests.post(voice_url, data={'cuid': '00:0c:29:c5:bd:ed', 'token': bd_access_token},
    headers={'Content-Type': 'audio/wav', 'Content-length': 86124, 'rate': 8000},
    files={'file': open(voice, 'rb')})
    return r.json()

    print(baidu_input('/Project/robot/test1.wav'))
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3951 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:51 · PVG 17:51 · LAX 01:51 · JFK 04:51
    ♥ Do have faith in what you're doing.