Spaces:
Runtime error
Runtime error
csukuangfj
commited on
Commit
•
4cd7d34
1
Parent(s):
0fba9cf
add more models
Browse files- model.py +80 -0
- requirements.txt +1 -1
model.py
CHANGED
@@ -72,6 +72,84 @@ def _get_vits_vctk(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
|
72 |
|
73 |
return tts
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
@lru_cache(maxsize=10)
|
77 |
def _get_vits_zh_aishell3(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
@@ -129,6 +207,8 @@ chinese_models = {
|
|
129 |
|
130 |
english_models = {
|
131 |
"csukuangfj/vits-vctk": _get_vits_vctk,
|
|
|
|
|
132 |
}
|
133 |
|
134 |
|
|
|
72 |
|
73 |
return tts
|
74 |
|
75 |
+
@lru_cache(maxsize=10)
|
76 |
+
def _get_vits_ljs(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
77 |
+
assert repo_id == "csukuangfj/vits-ljs"
|
78 |
+
|
79 |
+
model = get_file(
|
80 |
+
repo_id=repo_id,
|
81 |
+
filename="vits-ljs.onnx",
|
82 |
+
subfolder=".",
|
83 |
+
)
|
84 |
+
|
85 |
+
lexicon = get_file(
|
86 |
+
repo_id=repo_id,
|
87 |
+
filename="lexicon.txt",
|
88 |
+
subfolder=".",
|
89 |
+
)
|
90 |
+
|
91 |
+
tokens = get_file(
|
92 |
+
repo_id=repo_id,
|
93 |
+
filename="tokens.txt",
|
94 |
+
subfolder=".",
|
95 |
+
)
|
96 |
+
|
97 |
+
tts_config = sherpa_onnx.OfflineTtsConfig(
|
98 |
+
model=sherpa_onnx.OfflineTtsModelConfig(
|
99 |
+
vits=sherpa_onnx.OfflineTtsVitsModelConfig(
|
100 |
+
model=model,
|
101 |
+
lexicon=lexicon,
|
102 |
+
tokens=tokens,
|
103 |
+
length_scale=1.0 / speed,
|
104 |
+
),
|
105 |
+
provider="cpu",
|
106 |
+
debug=True,
|
107 |
+
num_threads=2,
|
108 |
+
)
|
109 |
+
)
|
110 |
+
tts = sherpa_onnx.OfflineTts(tts_config)
|
111 |
+
|
112 |
+
return tts
|
113 |
+
|
114 |
+
@lru_cache(maxsize=10)
|
115 |
+
def _get_vits_piper_en_US_lessac_medium(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
116 |
+
assert repo_id == "csukuangfj/vits-piper-en_US-lessac-medium"
|
117 |
+
|
118 |
+
model = get_file(
|
119 |
+
repo_id=repo_id,
|
120 |
+
filename="vits-piper-en_US-lessac-medium.onnx",
|
121 |
+
subfolder=".",
|
122 |
+
)
|
123 |
+
|
124 |
+
lexicon = get_file(
|
125 |
+
repo_id=repo_id,
|
126 |
+
filename="lexicon.txt",
|
127 |
+
subfolder=".",
|
128 |
+
)
|
129 |
+
|
130 |
+
tokens = get_file(
|
131 |
+
repo_id=repo_id,
|
132 |
+
filename="tokens.txt",
|
133 |
+
subfolder=".",
|
134 |
+
)
|
135 |
+
|
136 |
+
tts_config = sherpa_onnx.OfflineTtsConfig(
|
137 |
+
model=sherpa_onnx.OfflineTtsModelConfig(
|
138 |
+
vits=sherpa_onnx.OfflineTtsVitsModelConfig(
|
139 |
+
model=model,
|
140 |
+
lexicon=lexicon,
|
141 |
+
tokens=tokens,
|
142 |
+
length_scale=1.0 / speed,
|
143 |
+
),
|
144 |
+
provider="cpu",
|
145 |
+
debug=True,
|
146 |
+
num_threads=2,
|
147 |
+
)
|
148 |
+
)
|
149 |
+
tts = sherpa_onnx.OfflineTts(tts_config)
|
150 |
+
|
151 |
+
return tts
|
152 |
+
|
153 |
|
154 |
@lru_cache(maxsize=10)
|
155 |
def _get_vits_zh_aishell3(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
|
|
|
207 |
|
208 |
english_models = {
|
209 |
"csukuangfj/vits-vctk": _get_vits_vctk,
|
210 |
+
"csukuangfj/vits-piper-en_US-lessac-medium": _get_vits_piper_en_US_lessac_medium,
|
211 |
+
"csukuangfj/vits-ljs": _get_vits_ljs,
|
212 |
}
|
213 |
|
214 |
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
sherpa-onnx
|
2 |
soundfile
|
|
|
1 |
+
sherpa-onnx>=1.8.6
|
2 |
soundfile
|