一、开通灵积服务
控制台
地址,按照提示登录后即可正常开通。
![图片.png 图片.png](https://ucc.alicdn.com/pic/developer-ecology/hiwspwhvrvbmc_0e8a531ac853424d80103b79d805c354.png?x-oss-process=image/resize,w_1400/format,webp)
![图片.png 图片.png](https://ucc.alicdn.com/pic/developer-ecology/hiwspwhvrvbmc_4e87657125af425bb3564df226a46496.png?x-oss-process=image/resize,w_1400/format,webp)
二、安装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))
![图片.png 图片.png](https://ucc.alicdn.com/pic/developer-ecology/hiwspwhvrvbmc_3893d21d45e84af4bfdaa7e9d0aecfe1.png?x-oss-process=image/resize,w_1400/format,webp)
从测试的效果来看,模型整体的精度还是很高的,用户可以基于具体场景提供model即可。
![图片.png 图片.png](https://ucc.alicdn.com/pic/developer-ecology/hiwspwhvrvbmc_2a282b3b021b46aaa4a9ec0982c586ae.png?x-oss-process=image/resize,w_1400/format,webp)
更多参考
安装DashScope SDK
Paraformer语音识别API详情