diff --git a/src/runners/audio_transcriber.py b/src/runners/audio_transcriber.py index d4379f1..7f54112 100644 --- a/src/runners/audio_transcriber.py +++ b/src/runners/audio_transcriber.py @@ -74,7 +74,6 @@ def add(self, word): ): self.transcription += word.word - """ class BatchableAudioTranscriber(bentoml.Runnable): SUPPORTED_RESOURCES = ("nvidia.com/gpu", "cpu") @@ -232,7 +231,6 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]: for text in segments ] - """ from transformers import WhisperProcessor, WhisperForConditionalGeneration import torch @@ -300,4 +298,4 @@ def transcribe_audio(self, inputs: list[BatchInput]) -> list[str]: ) for text in segments ] -""" +""" \ No newline at end of file diff --git a/src/stt_api.py b/src/stt_api.py index 12315ad..16b5e27 100644 --- a/src/stt_api.py +++ b/src/stt_api.py @@ -70,6 +70,7 @@ async def handleUpstream( transciption = await runner_audio_transcriber.async_run( [BatchInput(audio=mic_data, lang=lang, pair=pair)] ) + t = datetime.now() process_time = datetime.now() - process_time out = transciption[0] @@ -84,6 +85,7 @@ async def handleUpstream( " ", out.restore_time, ) + t = (datetime.now() - t).total_seconds() if out.text: await pipe.push( @@ -94,6 +96,7 @@ async def handleUpstream( out.merge_audio_time + out.transcribe_time + out.restore_time, + t, ) ) finally: @@ -133,6 +136,7 @@ async def handleStream(pair): "final": text.final, "buffer": text.buffer_len, "process_time": text.process_time, + "time": text.time, } ) except Exception as e: diff --git a/src/utils/ipc/messages.py b/src/utils/ipc/messages.py index 9b88d67..a290bf6 100644 --- a/src/utils/ipc/messages.py +++ b/src/utils/ipc/messages.py @@ -19,6 +19,7 @@ class Text(msgspec.Struct, tag=True): final: bool buffer_len: int = 0 process_time: float = 0 + time: float = 0 Request = Publish | Subscribe | Ready | Text