add model
Browse files
app.py
CHANGED
@@ -49,11 +49,28 @@ tts_model_choice = DEFAULT_TTS_MODEL
|
|
49 |
vocoder = load_vocoder()
|
50 |
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
F5TTS_model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4)
|
54 |
return load_model(DiT, F5TTS_model_cfg, ckpt_path)
|
55 |
|
56 |
|
|
|
57 |
def load_e2tts(ckpt_path=str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.safetensors"))):
|
58 |
E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4)
|
59 |
return load_model(UNetT, E2TTS_model_cfg, ckpt_path)
|
|
|
49 |
vocoder = load_vocoder()
|
50 |
|
51 |
|
52 |
+
import os
|
53 |
+
from huggingface_hub import cached_path, HfApi
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
def load_f5tts():
|
58 |
+
# Carrega o caminho do modelo e o token das variáveis de ambiente
|
59 |
+
ckpt_path = os.getenv("MODEL_CKPT_PATH", "hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors")
|
60 |
+
token = os.getenv("HUGGINGFACE_TOKEN")
|
61 |
+
|
62 |
+
# Valida se o token está presente
|
63 |
+
if not token:
|
64 |
+
raise ValueError("A variável de ambiente 'HUGGINGFACE_TOKEN' não foi definida.")
|
65 |
+
|
66 |
+
# Carrega o modelo
|
67 |
+
ckpt_path = cached_path(ckpt_path, use_auth_token=token)
|
68 |
+
|
69 |
F5TTS_model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4)
|
70 |
return load_model(DiT, F5TTS_model_cfg, ckpt_path)
|
71 |
|
72 |
|
73 |
+
|
74 |
def load_e2tts(ckpt_path=str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.safetensors"))):
|
75 |
E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4)
|
76 |
return load_model(UNetT, E2TTS_model_cfg, ckpt_path)
|