未验证 提交 41af90f0 编写于 作者: Z Zth9730 提交者: GitHub

Update PP-ASR (#5661)

* Update PP-ASR

* Update app.py

* Update app.py
上级 6840dd99
...@@ -5,13 +5,20 @@ from paddlespeech.cli.text.infer import TextExecutor ...@@ -5,13 +5,20 @@ from paddlespeech.cli.text.infer import TextExecutor
import librosa import librosa
import soundfile as sf 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): def model_inference(audio):
asr = ASRExecutor()
text_punc = TextExecutor()
if not isinstance(audio, str): if not isinstance(audio, str):
audio = str(audio.name) audio = str(audio.name)
y, sr = librosa.load(audio) y, sr = sf.read(audio)
if sr != 16000: # Optional resample to 16000 if sr != 16000: # Optional resample to 16000
y = librosa.resample(y, sr, 16000) y = librosa.resample(y, sr, 16000)
sf.write(audio, y, 16000) sf.write(audio, y, 16000)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册