From c2da1b8749b3369a6a6f345ffc8d8a88e48382f1 Mon Sep 17 00:00:00 2001 From: Aaron_GenAI_SuperDEV Date: Fri, 6 Sep 2024 21:52:39 +0800 Subject: [PATCH] Update omni_streamlit.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解决ModuleNotFoundError: No module named 'utils'。因为 utils 模块在项目中的路径不在 Python 的默认搜索路径中,可以手动添加路径。例如,在 omni_streamlit.py 文件顶部添加代码。 --- webui/omni_streamlit.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webui/omni_streamlit.py b/webui/omni_streamlit.py index 9fcebf0..be66d4d 100644 --- a/webui/omni_streamlit.py +++ b/webui/omni_streamlit.py @@ -13,6 +13,13 @@ import tempfile import librosa import traceback from pydub import AudioSegment +import sys + +# 获取项目的根目录 +project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +# 将项目根目录添加到 sys.path +sys.path.append(project_root) + from utils.vad import get_speech_timestamps, collect_chunks, VadOptions