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:
@@ -36,12 +36,6 @@ class Segment(NamedTuple):
|
|||||||
no_speech_prob: float
|
no_speech_prob: float
|
||||||
|
|
||||||
|
|
||||||
class AudioInfo(NamedTuple):
|
|
||||||
language: str
|
|
||||||
language_probability: float
|
|
||||||
duration: float
|
|
||||||
|
|
||||||
|
|
||||||
class TranscriptionOptions(NamedTuple):
|
class TranscriptionOptions(NamedTuple):
|
||||||
beam_size: int
|
beam_size: int
|
||||||
best_of: int
|
best_of: int
|
||||||
@@ -63,6 +57,13 @@ class TranscriptionOptions(NamedTuple):
|
|||||||
append_punctuations: str
|
append_punctuations: str
|
||||||
|
|
||||||
|
|
||||||
|
class AudioInfo(NamedTuple):
|
||||||
|
language: str
|
||||||
|
language_probability: float
|
||||||
|
duration: float
|
||||||
|
transcription_options: TranscriptionOptions
|
||||||
|
|
||||||
|
|
||||||
class WhisperModel:
|
class WhisperModel:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@@ -321,6 +322,7 @@ class WhisperModel:
|
|||||||
language=language,
|
language=language,
|
||||||
language_probability=language_probability,
|
language_probability=language_probability,
|
||||||
duration=duration,
|
duration=duration,
|
||||||
|
transcription_options=options,
|
||||||
)
|
)
|
||||||
|
|
||||||
return segments, audio_info
|
return segments, audio_info
|
||||||
|
|||||||
Reference in New Issue
Block a user