Gregniuki commited on
Commit
1d6e329
·
verified ·
1 Parent(s): b90b696

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -212,7 +212,7 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
212
  gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text))
213
 
214
  # Calculate duration based on the lengths of ref_text and gen_text
215
- duration = min(2000, max(270, (ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed))))
216
 
217
  # Print the calculated duration
218
  print(f"Duration: {duration} seconds")
 
212
  gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text))
213
 
214
  # Calculate duration based on the lengths of ref_text and gen_text
215
+ duration = min(2000, max(270, int(0.75 * (ref_audio_len + ref_audio_len / ref_text_len * gen_text_len / speed))))
216
 
217
  # Print the calculated duration
218
  print(f"Duration: {duration} seconds")