fix: demucs固定separate_full模式

This commit is contained in:
yumoqing 2026-07-06 17:26:40 +08:00
parent 0fbc0d11cc
commit 216f2f9f59

View File

@ -197,7 +197,7 @@ async def handle_video_preparing(tenant_id, task_id, step_name, input_data, conf
# ── Demucs ─────────────────────────────────────────────────────────
async def handle_demucs_separating(tenant_id, task_id, step_name, input_data, config):
"""通过 API 调 ky-demucs-separate。"""
"""通过 API 调 ky-demucs-separate。固定使用 separate_full 模式。"""
work_dir = _task_dir(task_id)
audio_path = None
for dep_output in input_data.values():
@ -209,21 +209,25 @@ async def handle_demucs_separating(tenant_id, task_id, step_name, input_data, co
client = get_ktv_client()
result = await client.call(STEP_MODELS["demucs_separating"],
{"audio_file": audio_path})
{"audio_file": audio_path,
"task_type": "separate_full"})
if result.get("error"):
raise ValueError(f"Demucs 分离失败: {result['error']}")
# 下载结果文件
vocals_local = os.path.join(work_dir, "vocals.wav")
no_vocals_local = os.path.join(work_dir, "no_vocals.wav")
accompaniment_local = os.path.join(work_dir, "accompaniment.wav")
if result.get("vocals_url"):
await _download(result["vocals_url"], vocals_local)
if result.get("accompaniment_url"):
await _download(result["accompaniment_url"], no_vocals_local)
await _download(result["accompaniment_url"], accompaniment_local)
return {"vocals_path": vocals_local, "no_vocals_path": no_vocals_local,
"mode": "2stem", "usage": result.get("usage", {})}
return {"vocals_path": vocals_local,
"no_vocals_path": accompaniment_local,
"accompaniment_path": accompaniment_local,
"mode": "separate_full",
"usage": result.get("usage", {})}
# ── Lyric Calibration ──────────────────────────────────────────────