Merge pull request #94 from makaveli10/fix_error_messages

Fix: error messages.
This commit is contained in:
Marcus Edel
2024-01-11 09:52:07 -05:00
committed by GitHub
2 changed files with 4 additions and 10 deletions
+4 -7
View File
@@ -120,7 +120,7 @@ class TranscriptionServer:
elapsed_time = time.time() - self.clients_start_time[websocket] elapsed_time = time.time() - self.clients_start_time[websocket]
if elapsed_time >= self.max_connection_time: if elapsed_time >= self.max_connection_time:
self.clients[websocket].disconnect() 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[websocket].cleanup()
self.clients.pop(websocket) self.clients.pop(websocket)
self.clients_start_time.pop(websocket) self.clients_start_time.pop(websocket)
@@ -129,13 +129,11 @@ class TranscriptionServer:
break break
except Exception as e: 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: if self.clients[websocket].model_size is not None:
self.clients[websocket].cleanup() self.clients[websocket].cleanup()
self.clients.pop(websocket) self.clients.pop(websocket)
self.clients_start_time.pop(websocket) self.clients_start_time.pop(websocket)
logging.info("Connection Closed.")
logging.info(self.clients)
del websocket del websocket
break break
@@ -407,10 +405,10 @@ class ServeClient:
}) })
) )
except Exception as e: except Exception as e:
logging.error(f"[ERROR]: {e}") logging.error(f"[ERROR]: Failed to send message to client: {e}")
except Exception as e: except Exception as e:
logging.error(f"[ERROR]: {e}") logging.error(f"[ERROR]: Failed to transcribe audio chunk: {e}")
time.sleep(0.01) time.sleep(0.01)
def format_segment(self, start, end, text): def format_segment(self, start, end, text):
@@ -518,4 +516,3 @@ class ServeClient:
""" """
logging.info("Cleaning up.") logging.info("Cleaning up.")
self.exit = True self.exit = True
self.transcriber.destroy()
-3
View File
@@ -934,9 +934,6 @@ class WhisperModel:
) )
] ]
def destroy(self):
del self.model
def restore_speech_timestamps( def restore_speech_timestamps(
segments: Iterable[Segment], segments: Iterable[Segment],