Fix clone API: drop no-op instruct, serialize generation, clearer errors

- Remove the 'instruct' style field: Qwen3-TTS Base generate_voice_clone
  silently ignores it, so the UI option did nothing.
- Serialize generations with a lock so concurrent requests queue instead
  of doubling RAM/VRAM on one shared model.
- Validate empty text/ref_text ourselves so the API returns the Korean
  400 messages instead of FastAPI's generic 422.
- UI: explain that mic recording needs https/localhost instead of a raw
  TypeError on plain-http LAN access.
- README: document mic/https limit, queueing, and measured CPU speed.

Verified on CPU (Python 3.12, torch 2.14 CPU, 0.6B Base): wav and mp3
references, language ko/auto, two concurrent requests -> all 200 and
Whisper transcripts match the requested text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
voice_copy bot
2026-10-05 04:11:39 +09:00
parent 1b691b071b
commit a34f16123f
4 changed files with 32 additions and 28 deletions

7
app.py
View File

@@ -94,10 +94,9 @@ def health() -> dict:
@app.post("/api/clone")
async def clone(
ref_audio: UploadFile = File(...),
ref_text: str = Form(...),
text: str = Form(...),
ref_text: str = Form(""),
text: str = Form(""),
language: str = Form("auto"),
instruct: str = Form(""),
seed: str = Form(""),
) -> Response:
if not text.strip():
@@ -127,7 +126,7 @@ async def clone(
try:
audio, sr = await run_in_threadpool(
cloner.clone, wav_path, ref_text, text, language, instruct or None, seed_int
cloner.clone, wav_path, ref_text.strip(), text.strip(), language, seed_int
)
except Exception as exc: # noqa: BLE001
logger.exception("clone failed")