Skip to content

快速推理

hnluo edited this page Feb 8, 2023 · 1 revision

代码(infer.py):

from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

inference_pipeline = pipeline(
    task=Tasks.auto_speech_recognition,
    model='damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch')

rec_result = inference_pipeline(audio_in='https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/asr_example_zh.wav')
print(rec_result)

流程:

modelscope模型资源下载->音频文件加载->解码输出结果

运行命令

python infer.py

预期输出

{'text': '欢迎大家来体验达摩院推出的语音识别模型'}
Clone this wiki locally