Initial commit: Korean voice-cloning TTS prototype
FastAPI backend, web UI, CosyVoice3/F5-TTS setup scripts, and handoff docs for GPU PC continuation. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
34
scripts/select_model.sh
Executable file
34
scripts/select_model.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# 최종 모델 선택을 .env 와 config에 반영
|
||||
set -euo pipefail
|
||||
|
||||
MODEL="${1:-}"
|
||||
if [[ -z "$MODEL" || ! "$MODEL" =~ ^(cosyvoice|f5_tts)$ ]]; then
|
||||
echo "Usage: $0 cosyvoice|f5_tts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
ENV_FILE="$ROOT/.env"
|
||||
|
||||
if [[ -f "$ENV_FILE" ]]; then
|
||||
if grep -q '^TTS_MODEL=' "$ENV_FILE"; then
|
||||
sed -i.bak "s/^TTS_MODEL=.*/TTS_MODEL=$MODEL/" "$ENV_FILE"
|
||||
rm -f "$ENV_FILE.bak"
|
||||
else
|
||||
echo "TTS_MODEL=$MODEL" >> "$ENV_FILE"
|
||||
fi
|
||||
else
|
||||
cp "$ROOT/.env.example" "$ENV_FILE"
|
||||
echo "TTS_MODEL=$MODEL" >> "$ENV_FILE"
|
||||
fi
|
||||
|
||||
python3 - <<PY
|
||||
import json
|
||||
from pathlib import Path
|
||||
p = Path("$ROOT/config/model_choice.json")
|
||||
data = json.loads(p.read_text(encoding="utf-8"))
|
||||
data["selected_model"] = "$MODEL"
|
||||
p.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
print("selected_model=$MODEL")
|
||||
PY
|
||||
Reference in New Issue
Block a user