Spaces:
Running
Running
csukuangfj
commited on
Commit
·
85a7cc4
1
Parent(s):
c6ae40d
add kokoro
Browse files- model.py +46 -0
- requirements.txt +1 -1
model.py
CHANGED
@@ -119,6 +119,51 @@ def _get_vits_ljs(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
|
119 |
return tts
|
120 |
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
@lru_cache(maxsize=10)
|
123 |
def _get_vits_piper(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
124 |
data_dir = "/tmp/espeak-ng-data"
|
@@ -548,6 +593,7 @@ chinese_models = {
|
|
548 |
}
|
549 |
|
550 |
english_models = {
|
|
|
551 |
"csukuangfj/vits-piper-en_US-glados|1 speaker": _get_vits_piper,
|
552 |
"csukuangfj/vits-piper-en_GB-southern_english_male-medium|8 speakers": _get_vits_piper,
|
553 |
"csukuangfj/vits-piper-en_GB-southern_english_female-medium|6 speakers": _get_vits_piper,
|
|
|
119 |
return tts
|
120 |
|
121 |
|
122 |
+
@lru_cache(maxsize=10)
|
123 |
+
def _get_kokoro(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
124 |
+
assert repo_id in ("csukuangfj/kokoro-en-v0_19",)
|
125 |
+
data_dir = "/tmp/espeak-ng-data"
|
126 |
+
repo_id = repo_id.split("|")[0]
|
127 |
+
|
128 |
+
model = get_file(
|
129 |
+
repo_id=repo_id,
|
130 |
+
filename="model.onnx",
|
131 |
+
subfolder=".",
|
132 |
+
)
|
133 |
+
|
134 |
+
tokens = get_file(
|
135 |
+
repo_id=repo_id,
|
136 |
+
filename="tokens.txt",
|
137 |
+
subfolder=".",
|
138 |
+
)
|
139 |
+
|
140 |
+
voices = get_file(
|
141 |
+
repo_id=repo_id,
|
142 |
+
filename="voices.bin",
|
143 |
+
subfolder=".",
|
144 |
+
)
|
145 |
+
|
146 |
+
tts_config = sherpa_onnx.OfflineTtsConfig(
|
147 |
+
model=sherpa_onnx.OfflineTtsModelConfig(
|
148 |
+
kokoro=sherpa_onnx.OfflineTtsKokoroModelConfig(
|
149 |
+
model=model,
|
150 |
+
voices=voices,
|
151 |
+
tokens=tokens,
|
152 |
+
data_dir=data_dir,
|
153 |
+
length_scale=1.0 / speed,
|
154 |
+
),
|
155 |
+
provider="cpu",
|
156 |
+
debug=True,
|
157 |
+
num_threads=2,
|
158 |
+
),
|
159 |
+
max_num_sentences=1,
|
160 |
+
)
|
161 |
+
|
162 |
+
tts = sherpa_onnx.OfflineTts(tts_config)
|
163 |
+
|
164 |
+
return tts
|
165 |
+
|
166 |
+
|
167 |
@lru_cache(maxsize=10)
|
168 |
def _get_vits_piper(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
169 |
data_dir = "/tmp/espeak-ng-data"
|
|
|
593 |
}
|
594 |
|
595 |
english_models = {
|
596 |
+
"csukuangfj/kokoro-en-v0_19": _get_kokoro | 11,
|
597 |
"csukuangfj/vits-piper-en_US-glados|1 speaker": _get_vits_piper,
|
598 |
"csukuangfj/vits-piper-en_GB-southern_english_male-medium|8 speakers": _get_vits_piper,
|
599 |
"csukuangfj/vits-piper-en_GB-southern_english_female-medium|6 speakers": _get_vits_piper,
|
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.37
|
3 |
|
4 |
soundfile
|
|
|
1 |
+
https://huggingface.co/csukuangfj/sherpa-onnx-wheels/resolve/main/cpu/1.10.39/sherpa_onnx-1.10.39-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
2 |
#sherpa-onnx>=1.10.37
|
3 |
|
4 |
soundfile
|