Rename AudioInfo to TranscriptionInfo (#174)
This commit is contained in:
@@ -62,7 +62,7 @@ class TranscriptionOptions(NamedTuple):
|
|||||||
append_punctuations: str
|
append_punctuations: str
|
||||||
|
|
||||||
|
|
||||||
class AudioInfo(NamedTuple):
|
class TranscriptionInfo(NamedTuple):
|
||||||
language: str
|
language: str
|
||||||
language_probability: float
|
language_probability: float
|
||||||
duration: float
|
duration: float
|
||||||
@@ -176,7 +176,7 @@ class WhisperModel:
|
|||||||
append_punctuations: str = "\"'.。,,!!??::”)]}、",
|
append_punctuations: str = "\"'.。,,!!??::”)]}、",
|
||||||
vad_filter: bool = False,
|
vad_filter: bool = False,
|
||||||
vad_parameters: Optional[dict] = None,
|
vad_parameters: Optional[dict] = None,
|
||||||
) -> Tuple[Iterable[Segment], AudioInfo]:
|
) -> Tuple[Iterable[Segment], TranscriptionInfo]:
|
||||||
"""Transcribes an input file.
|
"""Transcribes an input file.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
@@ -226,7 +226,7 @@ class WhisperModel:
|
|||||||
A tuple with:
|
A tuple with:
|
||||||
|
|
||||||
- a generator over transcribed segments
|
- a generator over transcribed segments
|
||||||
- an instance of AudioInfo
|
- an instance of TranscriptionInfo
|
||||||
"""
|
"""
|
||||||
sampling_rate = self.feature_extractor.sampling_rate
|
sampling_rate = self.feature_extractor.sampling_rate
|
||||||
|
|
||||||
@@ -323,14 +323,14 @@ class WhisperModel:
|
|||||||
if speech_chunks:
|
if speech_chunks:
|
||||||
segments = restore_speech_timestamps(segments, speech_chunks, sampling_rate)
|
segments = restore_speech_timestamps(segments, speech_chunks, sampling_rate)
|
||||||
|
|
||||||
audio_info = AudioInfo(
|
info = TranscriptionInfo(
|
||||||
language=language,
|
language=language,
|
||||||
language_probability=language_probability,
|
language_probability=language_probability,
|
||||||
duration=duration,
|
duration=duration,
|
||||||
transcription_options=options,
|
transcription_options=options,
|
||||||
)
|
)
|
||||||
|
|
||||||
return segments, audio_info
|
return segments, info
|
||||||
|
|
||||||
def generate_segments(
|
def generate_segments(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user