csukuangfj commited on
Commit
9d145cc
1 Parent(s): 40de727

add a new german model

Browse files
Files changed (1) hide show
  1. model.py +43 -0
model.py CHANGED
@@ -113,6 +113,48 @@ def _get_vits_ljs(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
113
  return tts
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  @lru_cache(maxsize=10)
117
  def _get_vits_piper_de_DE_thorsten_medium(
118
  repo_id: str, speed: float
@@ -260,6 +302,7 @@ english_models = {
260
  }
261
 
262
  german_models = {
 
263
  "csukuangfj/vits-piper-de_DE-thorsten-medium": _get_vits_piper_de_DE_thorsten_medium,
264
  }
265
 
 
113
  return tts
114
 
115
 
116
+ @lru_cache(maxsize=10)
117
+ def _get_vits_piper_de_DE_thorsten_low(
118
+ repo_id: str, speed: float
119
+ ) -> sherpa_onnx.OfflineTts:
120
+ assert repo_id == "csukuangfj/vits-piper-de_DE-thorsten-low"
121
+
122
+ model = get_file(
123
+ repo_id=repo_id,
124
+ filename="de_DE-thorsten-low.onnx",
125
+ subfolder=".",
126
+ )
127
+
128
+ lexicon = get_file(
129
+ repo_id=repo_id,
130
+ filename="lexicon.txt",
131
+ subfolder=".",
132
+ )
133
+
134
+ tokens = get_file(
135
+ repo_id=repo_id,
136
+ filename="tokens.txt",
137
+ subfolder=".",
138
+ )
139
+
140
+ tts_config = sherpa_onnx.OfflineTtsConfig(
141
+ model=sherpa_onnx.OfflineTtsModelConfig(
142
+ vits=sherpa_onnx.OfflineTtsVitsModelConfig(
143
+ model=model,
144
+ lexicon=lexicon,
145
+ tokens=tokens,
146
+ length_scale=1.0 / speed,
147
+ ),
148
+ provider="cpu",
149
+ debug=True,
150
+ num_threads=2,
151
+ )
152
+ )
153
+ tts = sherpa_onnx.OfflineTts(tts_config)
154
+
155
+ return tts
156
+
157
+
158
  @lru_cache(maxsize=10)
159
  def _get_vits_piper_de_DE_thorsten_medium(
160
  repo_id: str, speed: float
 
302
  }
303
 
304
  german_models = {
305
+ "csukuangfj/vits-piper-de_DE-thorsten-low": _get_vits_piper_de_DE_thorsten_low,
306
  "csukuangfj/vits-piper-de_DE-thorsten-medium": _get_vits_piper_de_DE_thorsten_medium,
307
  }
308