V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
alittletrain
V2EX  ›  问与答

百度语音 REST-API 问题

  •  
  •   alittletrain · 2016-08-25 09:19:35 +08:00 · 1471 次点击
    这是一个创建于 2808 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    3 条回复    2016-08-25 10:04:20 +08:00
    xia0chun
        1
    xia0chun  
       2016-08-25 09:48:27 +08:00
    3300 是输入参数不正确
    请参考官方格式再试一遍
    http://yuyin.baidu.com/docs/asr/57
    alittletrain
        2
    alittletrain  
    OP
       2016-08-25 09:52:16 +08:00
    @xia0chun 已经试了 NNN 次了。。
    alittletrain
        3
    alittletrain  
    OP
       2016-08-25 10:04:20 +08:00
    @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'))
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2146 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:44 · PVG 23:44 · LAX 08:44 · JFK 11:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.