mrfakename commited on
Commit
43fa799
1 Parent(s): 7daec1c

Sync from GitHub repo

Browse files

This Space is synced from the GitHub repo: https://github.com/SWivid/F5-TTS. Please submit contributions to the Space there

Files changed (2) hide show
  1. app.py +4 -3
  2. src/f5_tts/infer/utils_infer.py +2 -1
app.py CHANGED
@@ -80,9 +80,9 @@ def generate_response(messages, model, tokenizer):
80
 
81
  @gpu_decorator
82
  def infer(
83
- ref_audio_orig, ref_text, gen_text, model, remove_silence, cross_fade_duration=0.15, speed=1
84
  ):
85
- ref_audio, ref_text = preprocess_ref_audio_text(ref_audio_orig, ref_text, show_info=gr.Info)
86
 
87
  if model == "F5-TTS":
88
  ema_model = F5TTS_ema_model
@@ -97,6 +97,7 @@ def infer(
97
  vocoder,
98
  cross_fade_duration=cross_fade_duration,
99
  speed=speed,
 
100
  progress=gr.Progress(),
101
  )
102
 
@@ -404,7 +405,7 @@ with gr.Blocks() as app_multistyle:
404
 
405
  # Generate speech for this segment
406
  audio, _ = infer(
407
- ref_audio, ref_text, text, model_choice, remove_silence, 0
408
  ) # show_info=print no pull to top when generating
409
  sr, audio_data = audio
410
 
 
80
 
81
  @gpu_decorator
82
  def infer(
83
+ ref_audio_orig, ref_text, gen_text, model, remove_silence, cross_fade_duration=0.15, speed=1, show_info=gr.Info
84
  ):
85
+ ref_audio, ref_text = preprocess_ref_audio_text(ref_audio_orig, ref_text, show_info=show_info)
86
 
87
  if model == "F5-TTS":
88
  ema_model = F5TTS_ema_model
 
97
  vocoder,
98
  cross_fade_duration=cross_fade_duration,
99
  speed=speed,
100
+ show_info=show_info,
101
  progress=gr.Progress(),
102
  )
103
 
 
405
 
406
  # Generate speech for this segment
407
  audio, _ = infer(
408
+ ref_audio, ref_text, text, model_choice, remove_silence, 0, show_info=print
409
  ) # show_info=print no pull to top when generating
410
  sr, audio_data = audio
411
 
src/f5_tts/infer/utils_infer.py CHANGED
@@ -278,7 +278,8 @@ def infer_process(
278
  gen_text_batches = chunk_text(gen_text, max_chars=max_chars)
279
  for i, gen_text in enumerate(gen_text_batches):
280
  print(f"gen_text {i}", gen_text)
281
-
 
282
  return infer_batch_process(
283
  (audio, sr),
284
  ref_text,
 
278
  gen_text_batches = chunk_text(gen_text, max_chars=max_chars)
279
  for i, gen_text in enumerate(gen_text_batches):
280
  print(f"gen_text {i}", gen_text)
281
+
282
+ show_info(f"Generating audio in {len(gen_text_batches)} batches...")
283
  return infer_batch_process(
284
  (audio, sr),
285
  ref_text,