Update infer_onnx.py
Browse files- infer_onnx.py +6 -0
infer_onnx.py
CHANGED
@@ -56,8 +56,14 @@ class TTS:
|
|
56 |
phoneme_ids_inter = self._intersperse(phoneme_ids, 0)
|
57 |
return phoneme_ids_inter
|
58 |
|
|
|
|
|
|
|
|
|
59 |
|
60 |
def __call__(self, text: str, length_scale=1.2):
|
|
|
|
|
61 |
phoneme_ids = self._get_seq(text)
|
62 |
text = np.expand_dims(np.array(phoneme_ids, dtype=np.int64), 0)
|
63 |
text_lengths = np.array([text.shape[1]], dtype=np.int64)
|
|
|
56 |
phoneme_ids_inter = self._intersperse(phoneme_ids, 0)
|
57 |
return phoneme_ids_inter
|
58 |
|
59 |
+
def _num2wordsshor(self, match):
|
60 |
+
match = match.group()
|
61 |
+
ret = num2words(match, lang ='ru')
|
62 |
+
return ret
|
63 |
|
64 |
def __call__(self, text: str, length_scale=1.2):
|
65 |
+
text = translit(text, 'ru')
|
66 |
+
text = re.sub(r'\d+',self._num2wordsshor,text)
|
67 |
phoneme_ids = self._get_seq(text)
|
68 |
text = np.expand_dims(np.array(phoneme_ids, dtype=np.int64), 0)
|
69 |
text_lengths = np.array([text.shape[1]], dtype=np.int64)
|