一、开通灵积服务
控制台
地址,按照提示登录后即可正常开通。


二、安装SDK并调用服务
pip install dashscope
注意:python需要3.7+
# For prerequisites running the following sample, visit https://help.aliyun.com/document_detail/611472.html
import dashscope
from urllib import request
import json
dashscope.api_key='ReaNkZ*************F4CD99C11ED9B2EB2ED6BC5D65D'
task_response=dashscope.audio.asr.Transcription.async_call(
model='paraformer-v1',
file_urls=['https://*****.oss-cn-shanghai.aliyuncs.com/%E5%A5%94%E8%B7%91.mp3']
)
transcription_response=dashscope.audio.asr.Transcription.wait(task=task_response.output.task_id)
transcription_url=transcription_response.output['results'][0]['transcription_url']
transcription_results=json.loads(request.urlopen(transcription_url).read().decode('utf8'))
print(json.dumps(transcription_results, indent=4, ensure_ascii=False))

从测试的效果来看,模型整体的精度还是很高的,用户可以基于具体场景提供model即可。

更多参考
安装DashScope SDK
Paraformer语音识别API详情