开始按照文档写这段# 读取文件 def get_file_content(filePath): with open(filePath, 'rb') as fp: return fp.read() # 识别本地文件 client.asr(get_file_content('audio.pcm'), 'pcm', 16000, { 'dev_pid': 1536, })       报错

bogon:Desktop 11002147$ /usr/local/var/pyenv/shims/python /Users/11002147/Downloads/py_aiplat_demo/demo/baiduaiasr.py

{'err_msg': 'param format invalid.', 'err_no': 3312, 'sn': '43141243141555056089'}

然后按照github写https://github.com/Baidu-AIP/speech-demo/blob/master/rest-api-asr/python/asr_raw.py这段,报错

{'access_token': '24.bed894e5cbf073604c0f14e75110ff0d.2592000.1557651030.282335-15803531', 'session_key': '9mzdWT/fLDko/KZ2UOzLMdQl12EYWXTksOiyzZrfjppJrdgFtuD0Ti/wSJj3QLvawJ89WDeJEnsToLSv/aWu/2xwmztGrQ==', 'scope': 'brain_enhanced_asr audio_voice_assistant_get audio_tts_post public brain_all_scope wise_adapt lebo_resource_base lightservice_public hetu_basic lightcms_map_poi kaidian_kaidian ApsMisTest_Test权限 vis-classify_flower lpq_开放 cop_helloScope ApsMis_fangdi_permission smartapp_snsapi_base iop_autocar oauth_tp_app smartapp_smart_game_openapi oauth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi', 'refresh_token': '25.30f14fc2bf5aef68801a001ceb21227c.315360000.1870419030.282335-15803531', 'session_secret': '51c504a912c6525e8c6342a3c1601c9d', 'expires_in': 2592000}

SUCCESS WITH TOKEN: 24.bed894e5cbf073604c0f14e75110ff0d.2592000.1557651030.282335-15803531 ; EXPIRES IN SECONDS: 2592000

url is http://vop.baidu.com/server_api?cuid=123456PYTHON&token=24.bed894e5cbf073604c0f14e75110ff0d.2592000.1557651030.282335-15803531&dev_pid=1536

header is {'Content-Type': 'audio/amr; rate=16000', 'Content-Length': 5045}

Request time cost 0.025776

{"err_msg":"param format invalid.","err_no":3312,"sn":"427061603791555059030"}

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐