- FastAPI 백엔드: /api/voices, /api/tts, /api/health - 한국어 메인 + 영어(5종 악센트), 중국어/일본어 UI 제거 - 언어별 목소리 모델 선택, 속도(0.5~2.0x)/피치(±12반음) 조절 - 로그인/사용제한/과금 유도 없음 (무제한 테스트) - NVIDIA GPU 자동 사용 (torch cu128, Blackwell sm_120) - 유저 친화 한국어 UI (frontend) - Docker/compose (GPU 예약), 8788 포트 - MeloTTS(순수 파이썬) 벤더링 + 검증된 버전 고정(constraints)
32 lines
1017 B
Python
32 lines
1017 B
Python
"""빌드 시 한국어/영어 모델과 부가 데이터(nltk 등)를 미리 내려받아 이미지에 캐시한다."""
|
|
import nltk
|
|
|
|
# g2p_en 은 구버전 리소스명을 받지만 nltk>=3.8.2 는 *_eng 리소스를 요구한다.
|
|
for _res in (
|
|
"averaged_perceptron_tagger",
|
|
"averaged_perceptron_tagger_eng",
|
|
"cmudict",
|
|
"punkt",
|
|
"punkt_tab",
|
|
):
|
|
try:
|
|
nltk.download(_res, quiet=True)
|
|
except Exception as _e: # pragma: no cover
|
|
print(f"[warmup] nltk {_res} 다운로드 경고: {_e}", flush=True)
|
|
|
|
from melo.api import TTS
|
|
|
|
SAMPLES = {
|
|
"KR": "안녕하세요. 준비가 완료되었습니다.",
|
|
"EN": "Hello, the model is ready.",
|
|
}
|
|
|
|
for lang, text in SAMPLES.items():
|
|
print(f"[warmup] loading {lang} ...", flush=True)
|
|
tts = TTS(language=lang, device="cpu")
|
|
spk_id = list(tts.hps.data.spk2id.values())[0]
|
|
tts.tts_to_file(text, spk_id, output_path=None, quiet=True)
|
|
print(f"[warmup] {lang} ok", flush=True)
|
|
|
|
print("[warmup] all done", flush=True)
|