From bcc6c2eea736c30b4f8bd56f1cacc4c97d11e375 Mon Sep 17 00:00:00 2001 From: gluttony-10 <326581344@qq.com> Date: Thu, 24 Apr 2025 23:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=88=E5=AF=B9Windows=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.spleeter==2.4.2需要的依赖,有一个没有版本。spleeter==2.4.0需要的依赖会与gradio需要的依赖产生冲突。所以先安装spleeter==2.4.0,再安装requirements。 2.zip命令无法直接在Windows中使用,所以改为调用patoolib进行压缩。并添加依赖patool。 --- app_lam_audio2exp.py | 26 ++++++++++++++++---------- requirements.txt | 5 +++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app_lam_audio2exp.py b/app_lam_audio2exp.py index 5acc4a0..bd90d10 100644 --- a/app_lam_audio2exp.py +++ b/app_lam_audio2exp.py @@ -34,6 +34,8 @@ try: except: pass +import patoolib + h5_rendering = True @@ -119,17 +121,21 @@ def parse_configs(): def create_zip_archive(output_zip='assets/arkitWithBSData.zip', base_dir=""): - import os - if (os.path.exists(output_zip)): + if os.path.exists(output_zip): os.remove(output_zip) - print(f"Reomve previous file: {output_zip}") - run_command = 'zip -r '+output_zip+' '+base_dir - os.system(run_command) - # check file - if(os.path.exists(output_zip)): + print(f"Remove previous file: {output_zip}") + + try: + # 创建压缩包 + patoolib.create_archive( + archive=output_zip, + filenames=[base_dir], # 要压缩的目录 + verbosity=-1, # 静默模式 + program='zip' # 指定使用zip格式 + ) print(f"Archive created successfully: {output_zip}") - else: - raise ValueError(f"Archive created failed: {output_zip}") + except Exception as e: + raise ValueError(f"Archive creation failed: {str(e)}") def demo_lam_audio2exp(infer, cfg): @@ -260,7 +266,7 @@ def demo_lam_audio2exp(infer, cfg): ) demo.queue() - demo.launch() + demo.launch(inbrowser=True) diff --git a/requirements.txt b/requirements.txt index 2e09298..5e29d79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -spleeter==2.4.2 +#spleeter==2.4.0 opencv_python_headless==4.11.0.86 gradio==5.25.2 omegaconf==2.3.0 @@ -7,4 +7,5 @@ yapf==0.40.1 librosa==0.11.0 transformers==4.36.2 termcolor==3.0.1 -numpy==1.26.3 \ No newline at end of file +numpy==1.26.3 +patool \ No newline at end of file