Spaces:
Sleeping
Sleeping
Update audio_model.py
Browse files- audio_model.py +14 -0
audio_model.py
CHANGED
@@ -14,6 +14,20 @@ speaker_embeddings = torch.tensor(embeddings_dataset[7440]["xvector"]).unsqueeze
|
|
14 |
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
### TEXT TO AUDIO SPEECH MODEL 2
|
18 |
# Define la función que convierte texto en voz
|
19 |
def synthesize_speech(text):
|
|
|
14 |
|
15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
|
17 |
+
replacements = [
|
18 |
+
("á", "a"),
|
19 |
+
("í", "i"),
|
20 |
+
("ñ", "n"),
|
21 |
+
("ó", "o"),
|
22 |
+
("ú", "u"),
|
23 |
+
("ü", "u"),
|
24 |
+
]
|
25 |
+
|
26 |
+
def cleanup_text(text):
|
27 |
+
for src, dst in replacements:
|
28 |
+
text = text.replace(src, dst)
|
29 |
+
return text
|
30 |
+
|
31 |
### TEXT TO AUDIO SPEECH MODEL 2
|
32 |
# Define la función que convierte texto en voz
|
33 |
def synthesize_speech(text):
|