ntt123 commited on
Commit
a31737b
1 Parent(s): 1559a52

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +4 -1
inference.py CHANGED
@@ -35,7 +35,10 @@ def text_to_mel(net, text, alphabet, config):
35
  """convert text to mel spectrogram"""
36
  text = english_cleaners(text)
37
  text = text + config["PAD"] * (100 - (len(text) % 100))
38
- tokens = [alphabet.index(c) for c in text]
 
 
 
39
  tokens = jnp.array(tokens, dtype=jnp.int32)
40
  mel = tacotron_inference_fn(net, tokens[None])
41
  return mel
 
35
  """convert text to mel spectrogram"""
36
  text = english_cleaners(text)
37
  text = text + config["PAD"] * (100 - (len(text) % 100))
38
+ tokens = []
39
+ for c in text:
40
+ if c in alphabet:
41
+ tokens.append(alphabet.index(c))
42
  tokens = jnp.array(tokens, dtype=jnp.int32)
43
  mel = tacotron_inference_fn(net, tokens[None])
44
  return mel