Gregniuki commited on
Commit
5419dac
·
verified ·
1 Parent(s): c0ab306

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -381,12 +381,12 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fa
381
  non_silent_wave += non_silent_seg
382
 
383
  aseg = non_silent_wave
384
- aseg = remove_silence_edges(aseg) + AudioSegment.silent(duration=50)
385
 
386
  audio_duration = len(aseg)
387
- if audio_duration > 7500:
388
  gr.Warning("Audio is over 8s, clipping to only first 8s.")
389
- aseg = aseg[:7500]
390
  aseg.export(f.name, format="wav")
391
  ref_audio = f.name
392
 
@@ -415,7 +415,7 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fa
415
  audio, sr = torchaudio.load(ref_audio)
416
 
417
  # Use the new chunk_text function to split gen_text
418
- max_chars = int((len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (14 - audio.shape[-1] / sr)))
419
  print(f"text: {gen_text} ")
420
  gen_text_batches = chunk_text(gen_text, max_chars=max_chars)
421
  print('ref_text', ref_text)
 
381
  non_silent_wave += non_silent_seg
382
 
383
  aseg = non_silent_wave
384
+ # aseg = remove_silence_edges(aseg) + AudioSegment.silent(duration=50)
385
 
386
  audio_duration = len(aseg)
387
+ if audio_duration > 8000:
388
  gr.Warning("Audio is over 8s, clipping to only first 8s.")
389
+ aseg = aseg[:8000]
390
  aseg.export(f.name, format="wav")
391
  ref_audio = f.name
392
 
 
415
  audio, sr = torchaudio.load(ref_audio)
416
 
417
  # Use the new chunk_text function to split gen_text
418
+ max_chars = int((len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (18 - audio.shape[-1] / sr)))
419
  print(f"text: {gen_text} ")
420
  gen_text_batches = chunk_text(gen_text, max_chars=max_chars)
421
  print('ref_text', ref_text)