csukuangfj commited on
Commit
588b97f
1 Parent(s): 9d145cc

add a new german model

Browse files
Files changed (1) hide show
  1. model.py +43 -0
model.py CHANGED
@@ -197,6 +197,48 @@ def _get_vits_piper_de_DE_thorsten_medium(
197
  return tts
198
 
199
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  @lru_cache(maxsize=10)
201
  def _get_vits_piper_en_US_lessac_medium(
202
  repo_id: str, speed: float
@@ -304,6 +346,7 @@ english_models = {
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
 
309
 
 
197
  return tts
198
 
199
 
200
+ @lru_cache(maxsize=10)
201
+ def _get_vits_piper_de_DE_thorsten_high(
202
+ repo_id: str, speed: float
203
+ ) -> sherpa_onnx.OfflineTts:
204
+ assert repo_id == "csukuangfj/vits-piper-de_DE-thorsten-high"
205
+
206
+ model = get_file(
207
+ repo_id=repo_id,
208
+ filename="de_DE-thorsten-high.onnx",
209
+ subfolder=".",
210
+ )
211
+
212
+ lexicon = get_file(
213
+ repo_id=repo_id,
214
+ filename="lexicon.txt",
215
+ subfolder=".",
216
+ )
217
+
218
+ tokens = get_file(
219
+ repo_id=repo_id,
220
+ filename="tokens.txt",
221
+ subfolder=".",
222
+ )
223
+
224
+ tts_config = sherpa_onnx.OfflineTtsConfig(
225
+ model=sherpa_onnx.OfflineTtsModelConfig(
226
+ vits=sherpa_onnx.OfflineTtsVitsModelConfig(
227
+ model=model,
228
+ lexicon=lexicon,
229
+ tokens=tokens,
230
+ length_scale=1.0 / speed,
231
+ ),
232
+ provider="cpu",
233
+ debug=True,
234
+ num_threads=2,
235
+ )
236
+ )
237
+ tts = sherpa_onnx.OfflineTts(tts_config)
238
+
239
+ return tts
240
+
241
+
242
  @lru_cache(maxsize=10)
243
  def _get_vits_piper_en_US_lessac_medium(
244
  repo_id: str, speed: float
 
346
  german_models = {
347
  "csukuangfj/vits-piper-de_DE-thorsten-low": _get_vits_piper_de_DE_thorsten_low,
348
  "csukuangfj/vits-piper-de_DE-thorsten-medium": _get_vits_piper_de_DE_thorsten_medium,
349
+ "csukuangfj/vits-piper-de_DE-thorsten-high": _get_vits_piper_de_DE_thorsten_high,
350
  }
351
 
352