update docstrings
This commit is contained in:
+18
-31
@@ -266,13 +266,10 @@ class ServeClient:
|
|||||||
Format the current incomplete transcription output by combining it with previous complete segments.
|
Format the current incomplete transcription output by combining it with previous complete segments.
|
||||||
The resulting transcription is wrapped into two lines, each containing a maximum of 50 characters.
|
The resulting transcription is wrapped into two lines, each containing a maximum of 50 characters.
|
||||||
|
|
||||||
Details:
|
It ensures that the combined transcription fits within two lines, with a maximum of 50 characters per line.
|
||||||
- This method is responsible for combining the current incomplete segment with a history of
|
Segments are concatenated in the order they exist in the list of previous segments, with the most
|
||||||
previous complete segments to provide a coherent and visually organized transcription.
|
|
||||||
- It ensures that the combined transcription fits within two lines, with a maximum of 50 characters per line.
|
|
||||||
- Segments are concatenated in the order they exist in the list of previous segments, with the most
|
|
||||||
recent complete segment first and older segments prepended as needed to maintain the character limit.
|
recent complete segment first and older segments prepended as needed to maintain the character limit.
|
||||||
- If a 3-second pause is detected in the previous segments, any text preceding it is discarded to ensure
|
If a 3-second pause is detected in the previous segments, any text preceding it is discarded to ensure
|
||||||
the transcription starts with the most recent complete content. The resulting transcription is returned
|
the transcription starts with the most recent complete content. The resulting transcription is returned
|
||||||
as a single string.
|
as a single string.
|
||||||
|
|
||||||
@@ -301,12 +298,9 @@ class ServeClient:
|
|||||||
of audio frames as they are received. It also ensures that the buffer does not exceed a specified size
|
of audio frames as they are received. It also ensures that the buffer does not exceed a specified size
|
||||||
to prevent excessive memory usage.
|
to prevent excessive memory usage.
|
||||||
|
|
||||||
Details:
|
If the buffer size exceeds a threshold (45 seconds of audio data), it discards the oldest 30 seconds
|
||||||
- The method appends incoming audio frames to the ongoing audio stream buffer.
|
of audio data to maintain a reasonable buffer size. If the buffer is empty, it initializes it with the provided
|
||||||
- If the buffer size exceeds a threshold (45 seconds of audio data), it discards the oldest 30 seconds
|
audio frame. The audio stream buffer is used for real-time processing of audio data for transcription.
|
||||||
of audio data to maintain a reasonable buffer size.
|
|
||||||
- If the buffer is empty, it initializes it with the provided audio frame.
|
|
||||||
- The audio stream buffer is used for real-time processing of audio data for transcription.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
frame_np (numpy.ndarray): The audio frame data as a NumPy array.
|
frame_np (numpy.ndarray): The audio frame data as a NumPy array.
|
||||||
@@ -329,12 +323,11 @@ class ServeClient:
|
|||||||
This method continuously receives audio frames, performs real-time transcription, and sends
|
This method continuously receives audio frames, performs real-time transcription, and sends
|
||||||
transcribed segments to the client via a WebSocket connection.
|
transcribed segments to the client via a WebSocket connection.
|
||||||
|
|
||||||
Details:
|
If the client's language is not detected, it waits for 30 seconds of audio input to make a language prediction.
|
||||||
- If the client's language is not detected, it waits for 30 seconds of audio input to make a language prediction.
|
It utilizes the Whisper ASR model to transcribe the audio, continuously processing and streaming results. Segments
|
||||||
- It utilizes the Whisper ASR model to transcribe the audio, continuously processing and streaming results.
|
are sent to the client in real-time, and a history of segments is maintained to provide context.Pauses in speech
|
||||||
- Segments are sent to the client in real-time, and a history of segments is maintained to provide context.
|
(no output from Whisper) are handled by showing the previous output for a set duration. A blank segment is added if
|
||||||
- Pauses in speech (no output from Whisper) are handled by showing the previous output for a set duration.
|
there is no speech for a specified duration to indicate a pause.
|
||||||
- A blank segment is added if there is no speech for a specified duration to indicate a pause.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
None
|
None
|
||||||
@@ -449,19 +442,13 @@ class ServeClient:
|
|||||||
Processes the segments from whisper. Appends all the segments to the list
|
Processes the segments from whisper. Appends all the segments to the list
|
||||||
except for the last segment assuming that it is incomplete.
|
except for the last segment assuming that it is incomplete.
|
||||||
|
|
||||||
This method takes segments obtained from the Whisper, processes them, and updates the
|
Updates the ongoing transcript with transcribed segments, including their start and end times.
|
||||||
ongoing transcript with the transcribed text. It handles complete segments, incomplete
|
Complete segments are appended to the transcript in chronological order. Incomplete segments
|
||||||
segments, and repeated segments while maintaining chronological order.
|
(assumed to be the last one) are processed to identify repeated content. If the same incomplete
|
||||||
|
segment is seen multiple times, it updates the offset and appends the segment to the transcript.
|
||||||
Details:
|
A threshold is used to detect repeated content and ensure it is only included once in the transcript.
|
||||||
- The method updates the ongoing transcript with transcribed segments, including their start and end times.
|
The timestamp offset is updated based on the duration of processed segments. The method returns the
|
||||||
- Complete segments are appended to the transcript in chronological order.
|
last processed segment, allowing it to be sent to the client for real-time updates.
|
||||||
- Incomplete segments (assumed to be the last one) are processed to identify repeated content. If
|
|
||||||
the same incomplete segment is seen multiple times, it updates the offset and appends the segment
|
|
||||||
to the transcript.
|
|
||||||
- A threshold is used to detect repeated content and ensure it is only included once in the transcript.
|
|
||||||
- The timestamp offset is updated based on the duration of processed segments.
|
|
||||||
- The method returns the last processed segment, allowing it to be sent to the client for real-time updates.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
segments(dict) : dictionary of segments as returned by whisper
|
segments(dict) : dictionary of segments as returned by whisper
|
||||||
|
|||||||
Reference in New Issue
Block a user