Skip to content

Commit

Permalink
when ref_text empty automatic transcribing
Browse files Browse the repository at this point in the history
  • Loading branch information
lpscr committed Oct 30, 2024
1 parent 02d5913 commit 3dd59b8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/f5_tts/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
infer_process,
remove_silence_for_generated_wav,
save_spectrogram,
preprocess_ref_audio_text,
target_sample_rate,
hop_length,
)


Expand All @@ -31,10 +34,8 @@ def __init__(
):
# Initialize parameters
self.final_wave = None
self.target_sample_rate = 24000
self.n_mel_channels = 100
self.hop_length = 256
self.target_rms = 0.1
self.target_sample_rate = target_sample_rate
self.hop_length = hop_length
self.seed = -1

# Set device
Expand Down Expand Up @@ -97,6 +98,10 @@ def infer(
seed = random.randint(0, sys.maxsize)
seed_everything(seed)
self.seed = seed

if ref_text == "":
ref_file, ref_text = preprocess_ref_audio_text(ref_file, ref_text, device=self.device)

wav, sr, spect = infer_process(
ref_file,
ref_text,
Expand Down

0 comments on commit 3dd59b8

Please sign in to comment.