# -*- coding: utf-8 -*-
"""
Created on Sat Dec 4 16:52:28 2021
@author: Tu Xiaopeng
"""
from aip import AipSpeech
""" 你的 APPID AK SK """
APP_ID = 'XXX' #个人的接口信息
API_KEY = 'XXX'
SECRET_KEY = 'XXX'
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
# 读取文件
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
# 识别本地文件
result=client.asr(get_file_content('文件路径'), 'wav', 16000, {
'dev_pid': 1537,
})
print(result['result'][0])