From 8b4602f738e451fb6563fde95c26c005dd999b28 Mon Sep 17 00:00:00 2001 From: WilliamZhang06 Date: Wed, 23 Feb 2022 17:47:42 +0800 Subject: [PATCH] added isinstance code, test=doc --- paddlespeech/cli/asr/infer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/paddlespeech/cli/asr/infer.py b/paddlespeech/cli/asr/infer.py index c2a096bf..c83df432 100644 --- a/paddlespeech/cli/asr/infer.py +++ b/paddlespeech/cli/asr/infer.py @@ -412,6 +412,11 @@ class ASRExecutor(BaseExecutor): logger.error("invalid sample rate, please input --sr 8000 or --sr 16000") return False + if isinstance(audio_file, (str, os.PathLike)): + if not os.path.isfile(audio_file): + logger.error("Please input the right audio file path") + return False + logger.info("checking the audio file format......") try: audio, audio_sample_rate = soundfile.read(