Skip to content

Commit

Permalink
Merge pull request #94 from makaveli10/fix_error_messages
Browse files Browse the repository at this point in the history
Fix: error messages.
  • Loading branch information
zoq authored Jan 11, 2024
2 parents 783d147 + d91330d commit a7eedc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 4 additions & 7 deletions whisper_live/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def recv_audio(self, websocket):
elapsed_time = time.time() - self.clients_start_time[websocket]
if elapsed_time >= self.max_connection_time:
self.clients[websocket].disconnect()
logging.warning(f"{self.clients[websocket]} Client disconnected due to overtime.")
logging.warning(f"Client with uid '{self.clients[websocket].client_uid}' disconnected due to overtime.")
self.clients[websocket].cleanup()
self.clients.pop(websocket)
self.clients_start_time.pop(websocket)
Expand All @@ -129,13 +129,11 @@ def recv_audio(self, websocket):
break

except Exception as e:
logging.error(e)
logging.info(f"[ERROR]: Client with uid '{self.clients[websocket].client_uid}' Disconnected.")
if self.clients[websocket].model_size is not None:
self.clients[websocket].cleanup()
self.clients.pop(websocket)
self.clients_start_time.pop(websocket)
logging.info("Connection Closed.")
logging.info(self.clients)
del websocket
break

Expand Down Expand Up @@ -407,10 +405,10 @@ def speech_to_text(self):
})
)
except Exception as e:
logging.error(f"[ERROR]: {e}")
logging.error(f"[ERROR]: Failed to send message to client: {e}")

except Exception as e:
logging.error(f"[ERROR]: {e}")
logging.error(f"[ERROR]: Failed to transcribe audio chunk: {e}")
time.sleep(0.01)

def format_segment(self, start, end, text):
Expand Down Expand Up @@ -518,4 +516,3 @@ def cleanup(self):
"""
logging.info("Cleaning up.")
self.exit = True
self.transcriber.destroy()
3 changes: 0 additions & 3 deletions whisper_live/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,9 +934,6 @@ def find_alignment(
)
]

def destroy(self):
del self.model


def restore_speech_timestamps(
segments: Iterable[Segment],
Expand Down

0 comments on commit a7eedc5

Please sign in to comment.