Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,16 +31,16 @@ tts_model = VitsModel.from_pretrained("facebook/mms-tts-kor")
|
|
31 |
tts_tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-kor")
|
32 |
tts_model.to("cuda" if torch.cuda.is_available() else "cpu")
|
33 |
|
34 |
-
from uroman import
|
|
|
|
|
35 |
|
36 |
def synthesize_tts(text: str):
|
37 |
-
romanized =
|
38 |
inputs = tts_tokenizer(romanized, return_tensors="pt")
|
39 |
input_ids = inputs["input_ids"].long().to(tts_model.device)
|
40 |
-
|
41 |
with torch.no_grad():
|
42 |
output = tts_model(input_ids=input_ids)
|
43 |
-
|
44 |
waveform = output.waveform.squeeze().cpu().numpy()
|
45 |
return (tts_model.config.sampling_rate, waveform)
|
46 |
|
|
|
31 |
tts_tokenizer = AutoTokenizer.from_pretrained("facebook/mms-tts-kor")
|
32 |
tts_model.to("cuda" if torch.cuda.is_available() else "cpu")
|
33 |
|
34 |
+
from uroman import Uroman
|
35 |
+
|
36 |
+
uroman = Uroman()
|
37 |
|
38 |
def synthesize_tts(text: str):
|
39 |
+
romanized = uroman.romanize(text)
|
40 |
inputs = tts_tokenizer(romanized, return_tensors="pt")
|
41 |
input_ids = inputs["input_ids"].long().to(tts_model.device)
|
|
|
42 |
with torch.no_grad():
|
43 |
output = tts_model(input_ids=input_ids)
|
|
|
44 |
waveform = output.waveform.squeeze().cpu().numpy()
|
45 |
return (tts_model.config.sampling_rate, waveform)
|
46 |
|