From 2b51a97e61ac99261b828bd7fdd918e84e98b5bb Mon Sep 17 00:00:00 2001 From: FlippFuzz <41221030+FlippFuzz@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:02:19 +0800 Subject: [PATCH] Add transcription_options to AudioInfo (#170) * Add transcription_options to AudioInfo It would be great if we can include the transcription_options in AudioInfo. My application is only making a few changes but leaving the rest as default. However, I would like to record down all settings (including those that I did not specify) so that the audio can be transcribed again identically in future if need be. * Make TranscriptionOptions appear before AudioInfo * Remove unnecessary whitespace --- faster_whisper/transcribe.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/faster_whisper/transcribe.py b/faster_whisper/transcribe.py index 2c544fc..5da7048 100644 --- a/faster_whisper/transcribe.py +++ b/faster_whisper/transcribe.py @@ -36,12 +36,6 @@ class Segment(NamedTuple): no_speech_prob: float -class AudioInfo(NamedTuple): - language: str - language_probability: float - duration: float - - class TranscriptionOptions(NamedTuple): beam_size: int best_of: int @@ -63,6 +57,13 @@ class TranscriptionOptions(NamedTuple): append_punctuations: str +class AudioInfo(NamedTuple): + language: str + language_probability: float + duration: float + transcription_options: TranscriptionOptions + + class WhisperModel: def __init__( self, @@ -321,6 +322,7 @@ class WhisperModel: language=language, language_probability=language_probability, duration=duration, + transcription_options=options, ) return segments, audio_info