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
This commit is contained in:
FlippFuzz
2023-04-24 21:02:19 +08:00
committed by GitHub
parent 358d373691
commit 2b51a97e61

View File

@@ -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