Gregniuki commited on
Commit
dd7ec70
·
verified ·
1 Parent(s): b33bfe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -168,7 +168,7 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
168
  # Prepare the text
169
  # if len(ref_text[-1].encode('utf-8')) == 1:
170
  #ref_text = ref_text + " "
171
- # gen_text = " " + gen_text
172
  text_list = [ref_text + gen_text]
173
  final_text_list = convert_char_to_pinyin(text_list)
174
 
@@ -186,10 +186,10 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
186
  ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text))
187
  gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text))
188
  if len(ref_text.encode('utf-8')) >= 3:
189
- duration = min(5000, max(300, (ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed))))
190
  print(f"Duration: {duration} seconds")
191
  else:
192
- duration = min(5000, max(300, int(133 * gen_text_len / (speed * 10))))
193
  print(f"Duration: {duration} seconds")
194
 
195
  # inference
 
168
  # Prepare the text
169
  # if len(ref_text[-1].encode('utf-8')) == 1:
170
  #ref_text = ref_text + " "
171
+ gen_text = " " + gen_text
172
  text_list = [ref_text + gen_text]
173
  final_text_list = convert_char_to_pinyin(text_list)
174
 
 
186
  ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text))
187
  gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text))
188
  if len(ref_text.encode('utf-8')) >= 3:
189
+ duration = min(2000, max(300, (ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed))))
190
  print(f"Duration: {duration} seconds")
191
  else:
192
+ duration = min(2000, max(300, int(150 * gen_text_len / (speed * 10))))
193
  print(f"Duration: {duration} seconds")
194
 
195
  # inference