提交 faf21f03 编写于 作者: H huangyuxin

add duration limitation for asr

上级 b02e0dae
......@@ -426,6 +426,11 @@ class ASRExecutor(BaseExecutor):
try:
audio, audio_sample_rate = soundfile.read(
audio_file, dtype="int16", always_2d=True)
audio_duration = audio.shape[0] / audio_sample_rate
max_duration = 30.0
if audio_duration >= max_duration:
logger.error("Please input audio file less then 30 seconds.\n")
return
except Exception as e:
logger.exception(e)
logger.error(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册