k1ngtai commited on
Commit
81ca94f
1 Parent(s): 3c0f7d1

Update tts.py

Browse files
Files changed (1) hide show
  1. tts.py +14 -8
tts.py CHANGED
@@ -20,6 +20,13 @@ from vits import commons, utils
20
  from vits.models import SynthesizerTrn
21
 
22
 
 
 
 
 
 
 
 
23
  class TextMapper(object):
24
  def __init__(self, vocab_file):
25
  self.symbols = [
@@ -84,12 +91,11 @@ class TextMapper(object):
84
  return text
85
 
86
 
87
- def synthesize(text, lang, speed):
88
-
89
  if speed is None:
90
  speed = 1.0
91
 
92
- lang_code = lang.split(":")[0].strip()
93
 
94
  vocab_file = hf_hub_download(
95
  repo_id="facebook/mms-tts",
@@ -165,9 +171,9 @@ def synthesize(text, lang, speed):
165
 
166
 
167
  TTS_EXAMPLES = [
168
- ["I am going to the store.", "eng: English"],
169
- ["안녕하세요", "kor: Korean"],
170
- ["क्या मुझे पीने का पानी मिल सकता है?", "hin: Hindi"],
171
- ["Tanış olmağıma çox şadam", "azj-script_latin: Azerbaijani, North"],
172
- ["Mu zo murna a cikin ƙasar.", "hau: Hausa"],
173
  ]
 
20
  from vits.models import SynthesizerTrn
21
 
22
 
23
+ TTS_LANGUAGES = {}
24
+ with open(f"data/tts/all_langs.tsv") as f:
25
+ for line in f:
26
+ iso, name = line.split(" ", 1)
27
+ TTS_LANGUAGES[iso] = name
28
+
29
+
30
  class TextMapper(object):
31
  def __init__(self, vocab_file):
32
  self.symbols = [
 
91
  return text
92
 
93
 
94
+ def synthesize(text, lang, speed=None):
 
95
  if speed is None:
96
  speed = 1.0
97
 
98
+ lang_code = lang.split()[0].strip()
99
 
100
  vocab_file = hf_hub_download(
101
  repo_id="facebook/mms-tts",
 
171
 
172
 
173
  TTS_EXAMPLES = [
174
+ ["I am going to the store.", "eng (English)"],
175
+ ["안녕하세요.", "kor (Korean)"],
176
+ ["क्या मुझे पीने का पानी मिल सकता है?", "hin (Hindi)"],
177
+ ["Tanış olmağıma çox şadam", "azj-script_latin (Azerbaijani, North)"],
178
+ ["Mu zo murna a cikin ƙasar.", "hau (Hausa)"],
179
  ]