Gregniuki commited on
Commit
4a14652
·
verified ·
1 Parent(s): f2dceb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -135,7 +135,7 @@ E2TTS_ema_model2 = load_custom(
135
  "hf://Gregniuki/F5-tts_English_German_Polish/Polish/model_500000.pt", "", F5TTS_model_cfg
136
  )
137
 
138
- def chunk_text(text, max_chars=80):
139
  """
140
  Splits the input text into chunks, each with a maximum number of characters.
141
  Args:
@@ -186,10 +186,12 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
186
  generated_waves = []
187
  spectrograms = []
188
 
189
- if len(ref_text[-1].encode("utf-8")) == 1:
190
- ref_text = ref_text + " "
191
  for i, gen_text in enumerate(progress.tqdm(gen_text_batches)):
192
  # Prepare the text
 
 
 
193
  text_list = [ref_text + gen_text]
194
  final_text_list = convert_char_to_pinyin(text_list)
195
 
@@ -353,7 +355,7 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fa
353
 
354
  # Use the new chunk_text function to split gen_text
355
  max_chars = int(len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr))
356
- gen_text_batches = chunk_text(gen_text, max_chars=80)
357
  print('ref_text', ref_text)
358
  for i, batch_text in enumerate(gen_text_batches):
359
  print(f'gen_text {i}', batch_text)
 
135
  "hf://Gregniuki/F5-tts_English_German_Polish/Polish/model_500000.pt", "", F5TTS_model_cfg
136
  )
137
 
138
+ def chunk_text(text, max_chars=100):
139
  """
140
  Splits the input text into chunks, each with a maximum number of characters.
141
  Args:
 
186
  generated_waves = []
187
  spectrograms = []
188
 
189
+
 
190
  for i, gen_text in enumerate(progress.tqdm(gen_text_batches)):
191
  # Prepare the text
192
+ if len(ref_text[-1].encode("utf-8")) == 1:
193
+ pref_text = ref_text + " "
194
+
195
  text_list = [ref_text + gen_text]
196
  final_text_list = convert_char_to_pinyin(text_list)
197
 
 
355
 
356
  # Use the new chunk_text function to split gen_text
357
  max_chars = int(len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr))
358
+ gen_text_batches = chunk_text(gen_text, max_chars=100)
359
  print('ref_text', ref_text)
360
  for i, batch_text in enumerate(gen_text_batches):
361
  print(f'gen_text {i}', batch_text)