fix number bug in whisperx alignment
This commit is contained in:
parent
4a3a8f11a7
commit
fd20265324
|
@ -74,6 +74,8 @@ class WhisperxModel:
|
||||||
|
|
||||||
def transcribe(self, audio_path):
|
def transcribe(self, audio_path):
|
||||||
segments = self.model.transcribe(audio_path, batch_size=8)["segments"]
|
segments = self.model.transcribe(audio_path, batch_size=8)["segments"]
|
||||||
|
for segment in segments:
|
||||||
|
segment['text'] = replace_numbers_with_words(segment['text'])
|
||||||
return self.align_model.align(segments, audio_path)
|
return self.align_model.align(segments, audio_path)
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +179,7 @@ def align(seed, transcript, audio_path):
|
||||||
if align_model is None:
|
if align_model is None:
|
||||||
raise gr.Error("Align model not loaded")
|
raise gr.Error("Align model not loaded")
|
||||||
seed_everything(seed)
|
seed_everything(seed)
|
||||||
|
transcript = replace_numbers_with_words(transcript).replace(" ", " ").replace(" ", " ")
|
||||||
fragments = align_segments(transcript, audio_path)
|
fragments = align_segments(transcript, audio_path)
|
||||||
segments = [{
|
segments = [{
|
||||||
"start": float(fragment["begin"]),
|
"start": float(fragment["begin"]),
|
||||||
|
|
Loading…
Reference in New Issue