csukuangfj commited on
Commit
dd6a80b
1 Parent(s): cbfcc94

update sherpa-onnx to use piper-phonemize

Browse files
Files changed (3) hide show
  1. app.py +13 -0
  2. model.py +2 -7
  3. requirements.txt +1 -1
app.py CHANGED
@@ -25,6 +25,7 @@ import uuid
25
 
26
  import gradio as gr
27
  import soundfile as sf
 
28
 
29
  from model import get_pretrained_model, language_to_models
30
 
@@ -185,7 +186,19 @@ with demo:
185
 
186
  gr.Markdown(description)
187
 
 
 
 
 
 
 
 
 
 
 
 
188
  if __name__ == "__main__":
 
189
  formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s"
190
 
191
  logging.basicConfig(format=formatter, level=logging.INFO)
 
25
 
26
  import gradio as gr
27
  import soundfile as sf
28
+ import system
29
 
30
  from model import get_pretrained_model, language_to_models
31
 
 
186
 
187
  gr.Markdown(description)
188
 
189
+
190
+ def download_espeak_ng_data():
191
+ os.sytem(
192
+ """
193
+ cd /tmp
194
+ wget https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/espeak-ng-data.tar.bz2
195
+ tar xf espeak-ng-data.tar.bz2
196
+ """
197
+ )
198
+
199
+
200
  if __name__ == "__main__":
201
+ download_espeak_ng_data()
202
  formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s"
203
 
204
  logging.basicConfig(format=formatter, level=logging.INFO)
model.py CHANGED
@@ -124,12 +124,6 @@ def _get_vits_piper(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
124
  subfolder=".",
125
  )
126
 
127
- lexicon = get_file(
128
- repo_id=repo_id,
129
- filename="lexicon.txt",
130
- subfolder=".",
131
- )
132
-
133
  tokens = get_file(
134
  repo_id=repo_id,
135
  filename="tokens.txt",
@@ -140,7 +134,8 @@ def _get_vits_piper(repo_id: str, speed: float) -> sherpa_onnx.OfflineTts:
140
  model=sherpa_onnx.OfflineTtsModelConfig(
141
  vits=sherpa_onnx.OfflineTtsVitsModelConfig(
142
  model=model,
143
- lexicon=lexicon,
 
144
  tokens=tokens,
145
  length_scale=1.0 / speed,
146
  ),
 
124
  subfolder=".",
125
  )
126
 
 
 
 
 
 
 
127
  tokens = get_file(
128
  repo_id=repo_id,
129
  filename="tokens.txt",
 
134
  model=sherpa_onnx.OfflineTtsModelConfig(
135
  vits=sherpa_onnx.OfflineTtsVitsModelConfig(
136
  model=model,
137
+ lexicon="",
138
+ data_dir="/tmp/espeak-ng-data",
139
  tokens=tokens,
140
  length_scale=1.0 / speed,
141
  ),
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- https://huggingface.co/csukuangfj/wheels/resolve/main/sherpa_onnx-1.8.9-cp38-cp38-linux_x86_64.whl
2
  #sherpa-onnx
3
 
4
  soundfile
 
1
+ https://huggingface.co/csukuangfj/wheels/resolve/main/sherpa_onnx-1.8.11-cp38-cp38-linux_x86_64.whl
2
  #sherpa-onnx
3
 
4
  soundfile