From 9bb92b9bb2f65b19077df4b1f17e5d46387a7649 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Thu, 15 Feb 2024 17:59:12 +0530 Subject: [PATCH] use_vad option and send end of audio message --- whisper_live/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/whisper_live/client.py b/whisper_live/client.py index 888d238..49c5f7e 100644 --- a/whisper_live/client.py +++ b/whisper_live/client.py @@ -17,6 +17,7 @@ class Client: Handles audio recording, streaming, and communication with a server using WebSocket. """ INSTANCES = {} + END_OF_AUDIO = "END_OF_AUDIO" def __init__( self, @@ -203,7 +204,7 @@ class Client: "language": self.language, "task": self.task, "model": self.model, - "use_vad": self.use_vad, + "use_vad": self.use_vad } ) ) @@ -274,7 +275,7 @@ class Client: self.stream.write(data) wavfile.close() - + self.send_packet_to_server(Client.END_OF_AUDIO.encode('utf-8')) # Ensure it's sent as bytes assert self.last_response_recieved while time.time() - self.last_response_recieved < self.disconnect_if_no_response_for: continue