Add custom vocabulary / hotwords support

This commit is contained in:
Aaron Boxer
2026-04-17 09:36:05 -04:00
committed by Aaron Boxer
parent 9a71a95ca8
commit 4210697ca6
4 changed files with 16 additions and 4 deletions
+5
View File
@@ -43,6 +43,7 @@ class Client:
translation_srt_file_path="output_translated.srt",
enable_timestamps=False,
display_segments=4,
hotwords=None,
):
"""
Initializes a Client instance for audio recording and streaming to a server.
@@ -101,6 +102,7 @@ class Client:
self.task = "translate"
self.enable_timestamps = enable_timestamps
self.display_segments = display_segments
self.hotwords = hotwords
self.audio_bytes = None
@@ -299,6 +301,7 @@ class Client:
"same_output_threshold": self.same_output_threshold,
"enable_translation": self.enable_translation,
"target_language": self.target_language,
"hotwords": self.hotwords,
}
)
)
@@ -820,6 +823,7 @@ class TranscriptionClient(TranscriptionTeeClient):
translation_srt_file_path="./output_translated.srt",
enable_timestamps=False,
display_segments=4,
hotwords=None,
):
self.client = Client(
host,
@@ -842,6 +846,7 @@ class TranscriptionClient(TranscriptionTeeClient):
translation_srt_file_path=translation_srt_file_path,
enable_timestamps=enable_timestamps,
display_segments=display_segments,
hotwords=hotwords,
)
if save_output_recording and not output_recording_filename.endswith(".wav"):