diff --git a/paddlespeech/cli/asr/infer.py b/paddlespeech/cli/asr/infer.py index c2a096bfa8e47a9c1c6052f8192b9ae4fdc6f7f8..c83df432c73a29e263dcd4dcdaac833a30c51a39 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(