csukuangfj commited on
Commit
a0759c1
1 Parent(s): 8a484fa

update test

Browse files
Files changed (4) hide show
  1. test-0.wav +0 -0
  2. test-1.wav +0 -0
  3. test-2.wav +0 -0
  4. test.py +24 -23
test-0.wav ADDED
Binary file (168 kB). View file
 
test-1.wav ADDED
Binary file (264 kB). View file
 
test-2.wav ADDED
Binary file (307 kB). View file
 
test.py CHANGED
@@ -147,33 +147,13 @@ def get_text(text, lexicon, tokens, punctuation):
147
  return ans
148
 
149
 
150
- def main():
151
- model = OnnxModel("./vits-ljs.onnx")
152
-
153
- lexicon = read_lexicon()
154
- tokens = read_tokens()
155
- convert_lexicon(lexicon, tokens)
156
-
157
- x = get_text(
158
- "Liliana, our most beautiful and lovely assistant",
159
- lexicon,
160
- tokens,
161
- model.punctuation,
162
- )
163
- # x = get_text(
164
- # "Ask not what your country can do for you; ask what you can do for your country.",
165
- # lexicon,
166
- # tokens,
167
- # model.punctuation,
168
- # )
169
-
170
  x = get_text(
171
- "Success is not final, failure is not fatal, it is the courage to continue that counts!",
172
  lexicon,
173
  tokens,
174
  model.punctuation,
175
  )
176
-
177
  if model.add_blank:
178
  x2 = [0] * (2 * len(x) + 1)
179
  x2[1::2] = x
@@ -182,7 +162,28 @@ def main():
182
  x = torch.tensor(x, dtype=torch.int64)
183
 
184
  y = model(x)
185
- soundfile.write("test.wav", y.numpy(), model.sample_rate)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
 
188
  if __name__ == "__main__":
 
147
  return ans
148
 
149
 
150
+ def generate(model, text, lexicon, tokens):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  x = get_text(
152
+ text,
153
  lexicon,
154
  tokens,
155
  model.punctuation,
156
  )
 
157
  if model.add_blank:
158
  x2 = [0] * (2 * len(x) + 1)
159
  x2[1::2] = x
 
162
  x = torch.tensor(x, dtype=torch.int64)
163
 
164
  y = model(x)
165
+
166
+ return y
167
+
168
+
169
+ def main():
170
+ model = OnnxModel("./vits-ljs.onnx")
171
+
172
+ lexicon = read_lexicon()
173
+ tokens = read_tokens()
174
+ convert_lexicon(lexicon, tokens)
175
+
176
+ text = "Liliana, our most beautiful and lovely assistant"
177
+ y = generate(model, text, lexicon, tokens)
178
+ soundfile.write("test-0.wav", y.numpy(), model.sample_rate)
179
+
180
+ text = "Ask not what your country can do for you; ask what you can do for your country."
181
+ y = generate(model, text, lexicon, tokens)
182
+ soundfile.write("test-1.wav", y.numpy(), model.sample_rate)
183
+
184
+ text = "Success is not final, failure is not fatal, it is the courage to continue that counts!"
185
+ y = generate(model, text, lexicon, tokens)
186
+ soundfile.write("test-2.wav", y.numpy(), model.sample_rate)
187
 
188
 
189
  if __name__ == "__main__":