Gregniuki commited on
Commit
5d89b27
·
verified ·
1 Parent(s): cc97bdc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -27,6 +27,7 @@ from infer.utils_infer import (
27
  remove_silence_for_generated_wav,
28
  save_spectrogram,
29
  )
 
30
  from transformers import pipeline
31
  import click
32
  import soundfile as sf
@@ -245,7 +246,11 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
245
  for i, gen_text in enumerate(progress.tqdm(gen_text_batches)):
246
  # Prepare the text
247
  text_list = [ref_text + gen_text]
248
- final_text_list = convert_char_to_pinyin(text_list)
 
 
 
 
249
 
250
  # Calculate reference audio length
251
  ref_audio_len = audio.shape[-1] // hop_length
 
27
  remove_silence_for_generated_wav,
28
  save_spectrogram,
29
  )
30
+ from tokenizers import Tokenizer
31
  from transformers import pipeline
32
  import click
33
  import soundfile as sf
 
246
  for i, gen_text in enumerate(progress.tqdm(gen_text_batches)):
247
  # Prepare the text
248
  text_list = [ref_text + gen_text]
249
+ encoding = tokenizer.encode(text_list)
250
+ tokens = encoding.tokens
251
+ text_list = ' '.join(map(str, tokens))
252
+
253
+ final_text_list = [text_list]
254
 
255
  # Calculate reference audio length
256
  ref_audio_len = audio.shape[-1] // hop_length