tu commited on
Commit
c17bcc7
1 Parent(s): 9a436eb

update model + change preprocess

Browse files
Files changed (2) hide show
  1. app.py +22 -4
  2. model.onnx +2 -2
app.py CHANGED
@@ -10,11 +10,29 @@ from text import text_to_sequence
10
  from scipy.io.wavfile import write
11
  from preprocess import preprocess
12
  import onnxruntime
 
13
 
14
  def get_text(texts, hps):
15
  text_norm_list = []
16
- for text in texts.split(","):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  text = preprocess(text)
 
18
  chunk_strings = []
19
  chunk_len = 30
20
  for i in range(0, len(text.split()), chunk_len):
@@ -29,8 +47,8 @@ def get_text(texts, hps):
29
 
30
  def tts(text):
31
  model_path = "model.onnx"
32
- config_path = "config.json"
33
- sid = 4
34
  output_wav_path = "output.wav"
35
  sess_options = onnxruntime.SessionOptions()
36
  model = onnxruntime.InferenceSession(str(model_path), sess_options=sess_options, providers=["CPUExecutionProvider"])
@@ -43,7 +61,7 @@ def tts(text):
43
  for stn_tst in stn_tst_list:
44
  text = np.expand_dims(np.array(stn_tst, dtype=np.int64), 0)
45
  text_lengths = np.array([text.shape[1]], dtype=np.int64)
46
- scales = np.array([0.667, 1.1, 0.85], dtype=np.float32)
47
  sid = np.array([int(sid)]) if sid is not None else None
48
 
49
  audio = model.run(
 
10
  from scipy.io.wavfile import write
11
  from preprocess import preprocess
12
  import onnxruntime
13
+ import re
14
 
15
  def get_text(texts, hps):
16
  text_norm_list = []
17
+ texts = texts.replace("“", "")
18
+ texts = texts.replace("”", "")
19
+ texts = texts.replace("…", ".")
20
+ texts = re.split('[!:;\.\n]', texts)
21
+ tmp = []
22
+ for t in texts:
23
+ t = t.rstrip().strip()
24
+ if len(t) > 0:
25
+ tmp.append(t)
26
+ texts = []
27
+ for t in tmp:
28
+ texts.append(t)
29
+ texts.append(".")
30
+ #texts.append(".")
31
+
32
+ #print(texts)
33
+ for text in texts:
34
  text = preprocess(text)
35
+ print(text)
36
  chunk_strings = []
37
  chunk_len = 30
38
  for i in range(0, len(text.split()), chunk_len):
 
47
 
48
  def tts(text):
49
  model_path = "model.onnx"
50
+ config_path = "configs/thu_hue.json"
51
+ sid = 9
52
  output_wav_path = "output.wav"
53
  sess_options = onnxruntime.SessionOptions()
54
  model = onnxruntime.InferenceSession(str(model_path), sess_options=sess_options, providers=["CPUExecutionProvider"])
 
61
  for stn_tst in stn_tst_list:
62
  text = np.expand_dims(np.array(stn_tst, dtype=np.int64), 0)
63
  text_lengths = np.array([text.shape[1]], dtype=np.int64)
64
+ scales = np.array([0.667, 1.08, 0.8], dtype=np.float32)
65
  sid = np.array([int(sid)]) if sid is not None else None
66
 
67
  audio = model.run(
model.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4a0c9c2e2ce10af648bf6b0718feac0d23cb713da66452168674d467c68f1c52
3
- size 123389245
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c781e3fdb725651e0074d4549e272fe22d4cc71872b098bbc62d6bb995b567c4
3
+ size 130096954