This commit is contained in:
yinsx
2025-12-24 15:15:13 +08:00
commit df085f3f8f
27 changed files with 1926 additions and 0 deletions

41
scripts/run_a2f.py Normal file
View File

@ -0,0 +1,41 @@
import subprocess
import sys
from pathlib import Path
# ========= 基础路径 =========
BASE_DIR = Path(__file__).parent.parent
A2F_SCRIPT = BASE_DIR / "external" / "Audio2Face-3D-Samples" / "scripts" / "audio2face_3d_microservices_interaction_app" / "a2f_3d.py"
AUDIO_FILE = BASE_DIR / "data" / "input" / "audio" / "Mark_joy.wav"
CONFIG_FILE = BASE_DIR / "external" / "Audio2Face-3D-Samples" / "scripts" / "audio2face_3d_microservices_interaction_app" / "config" / "config_james.yml"
A2F_URL = "192.168.1.39:52000"
# ========= 调用命令 =========
cmd = [
sys.executable, # 使用当前 venv 的 python
str(A2F_SCRIPT),
"run_inference",
str(AUDIO_FILE),
str(CONFIG_FILE),
"--url",
A2F_URL
]
print("Running Audio2Face-3D inference...")
print("Command:", " ".join(cmd))
result = subprocess.run(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True
)
print("=== A2F OUTPUT ===")
print(result.stdout)
if result.returncode != 0:
raise RuntimeError("Audio2Face-3D inference failed")
print("Inference finished successfully.")