From 41af90f055f9caf204b0b61c9717eda99bc04952 Mon Sep 17 00:00:00 2001 From: Zth9730 <32243340+Zth9730@users.noreply.github.com> Date: Wed, 23 Nov 2022 14:49:50 +0800 Subject: [PATCH] Update PP-ASR (#5661) * Update PP-ASR * Update app.py * Update app.py --- modelcenter/PP-ASR/APP/app.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modelcenter/PP-ASR/APP/app.py b/modelcenter/PP-ASR/APP/app.py index f840416d..9a7fafc9 100755 --- a/modelcenter/PP-ASR/APP/app.py +++ b/modelcenter/PP-ASR/APP/app.py @@ -5,13 +5,20 @@ from paddlespeech.cli.text.infer import TextExecutor import librosa import soundfile as sf +os.system("wget -c 'https://paddlespeech.bj.bcebos.com/PaddleAudio/zh.wav'") +asr = ASRExecutor() +text_punc = TextExecutor() +tmp_result = asr(audio_file='zh.wav', + model='conformer_online_wenetspeech', + device="cpu") +tmp_result = text_punc( + text=tmp_result, model='ernie_linear_p7_wudao', device="cpu") + def model_inference(audio): - asr = ASRExecutor() - text_punc = TextExecutor() if not isinstance(audio, str): audio = str(audio.name) - y, sr = librosa.load(audio) + y, sr = sf.read(audio) if sr != 16000: # Optional resample to 16000 y = librosa.resample(y, sr, 16000) sf.write(audio, y, 16000) -- GitLab