Spaces:
Running
Running
Commit
·
cc47269
1
Parent(s):
f6edd8a
add fa-en
Browse files- model.py +50 -0
- requirements.txt +1 -1
model.py
CHANGED
@@ -324,6 +324,54 @@ def _get_vits_zh_aishell3(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
|
324 |
return tts
|
325 |
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
@lru_cache(maxsize=10)
|
328 |
def _get_matcha_hf(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
329 |
repo_id = repo_id.split("|")[0]
|
@@ -610,6 +658,8 @@ chinese_english_models = {
|
|
610 |
}
|
611 |
|
612 |
persian_english_models = {
|
|
|
|
|
613 |
"csukuangfj/vits-piper-fa_en-rezahedayatfar-ibrahimwalk-medium|1": _get_vits_piper, # 1
|
614 |
}
|
615 |
|
|
|
324 |
return tts
|
325 |
|
326 |
|
327 |
+
@lru_cache(maxsize=10)
|
328 |
+
def _get_matcha_hf_espeak(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
329 |
+
repo_id = repo_id.split("|")[0]
|
330 |
+
assert repo_id in (
|
331 |
+
"csukuangfj/matcha-tts-fa_en-female",
|
332 |
+
"csukuangfj/matcha-tts-fa_en-male",
|
333 |
+
), repo_id
|
334 |
+
|
335 |
+
acoustic_model = get_file(
|
336 |
+
repo_id=repo_id,
|
337 |
+
filename="model.onnx",
|
338 |
+
subfolder=".",
|
339 |
+
)
|
340 |
+
|
341 |
+
vocoder = get_file(
|
342 |
+
repo_id="csukuangfj/sherpa-onnx-hifigan",
|
343 |
+
filename="hifigan_v2.onnx",
|
344 |
+
subfolder=".",
|
345 |
+
)
|
346 |
+
|
347 |
+
tokens = get_file(
|
348 |
+
repo_id=repo_id,
|
349 |
+
filename="tokens.txt",
|
350 |
+
subfolder=".",
|
351 |
+
)
|
352 |
+
|
353 |
+
data_dir = "/tmp/espeak-ng-data"
|
354 |
+
tts_config = sherpa_onnx.OfflineTtsConfig(
|
355 |
+
model=sherpa_onnx.OfflineTtsModelConfig(
|
356 |
+
vits=sherpa_onnx.OfflineTtsVitsModelConfig(),
|
357 |
+
matcha=sherpa_onnx.OfflineTtsMatchaModelConfig(
|
358 |
+
acoustic_model=acoustic_model,
|
359 |
+
vocoder=vocoder,
|
360 |
+
tokens=tokens,
|
361 |
+
data_dir=data_dir,
|
362 |
+
length_scale=1.0 / speed,
|
363 |
+
),
|
364 |
+
provider="cpu",
|
365 |
+
debug=True,
|
366 |
+
num_threads=2,
|
367 |
+
),
|
368 |
+
max_num_sentences=1,
|
369 |
+
)
|
370 |
+
tts = sherpa_onnx.OfflineTts(tts_config)
|
371 |
+
|
372 |
+
return tts
|
373 |
+
|
374 |
+
|
375 |
@lru_cache(maxsize=10)
|
376 |
def _get_matcha_hf(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
377 |
repo_id = repo_id.split("|")[0]
|
|
|
658 |
}
|
659 |
|
660 |
persian_english_models = {
|
661 |
+
"csukuangfj/matcha-tts-fa_en-female|1 speaker": _get_matcha_hf_espeak, # 1
|
662 |
+
"csukuangfj/matcha-tts-fa_en-male|1 speaker": _get_matcha_hf_espeak, # 1
|
663 |
"csukuangfj/vits-piper-fa_en-rezahedayatfar-ibrahimwalk-medium|1": _get_vits_piper, # 1
|
664 |
}
|
665 |
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/cpu/1.10.
|
2 |
#sherpa-onnx>=1.10.42
|
3 |
|
4 |
soundfile
|
|
|
1 |
+
https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/cpu/1.10.43/sherpa_onnx-1.10.43-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
2 |
#sherpa-onnx>=1.10.42
|
3 |
|
4 |
soundfile
|