From 5776c05bdac1437d17dbc8d45b78de0502a098a6 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 5 Aug 2024 17:00:39 +0800 Subject: [PATCH] bugfix --- app/asr_engine.py | 8 ++++---- app/whisper_model.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/asr_engine.py b/app/asr_engine.py index fae1244..58dffe6 100644 --- a/app/asr_engine.py +++ b/app/asr_engine.py @@ -9,8 +9,8 @@ async def generate(request, **kw): params_kw = kw.get('params_kw', DictObject()) info(f'{params_kw=}') model = params_kw.model - audiob64 = params_kw.audiob64 - if audiob64 is None: + audio = params_kw.audio + if audio is None: return { 'status':'error', 'message':'audio is null' @@ -26,8 +26,8 @@ async def generate(request, **kw): 'message':f'model={model} is not defined' } try: - txt = await engine.stt(audiob64) - info(f'{audiob64=}, {txt=}') + txt = await engine.stt(audio) + info(f'{audio=}, {txt=}') return { "status":"ok", "content":txt diff --git a/app/whisper_model.py b/app/whisper_model.py index 65a2f56..4540d04 100644 --- a/app/whisper_model.py +++ b/app/whisper_model.py @@ -31,12 +31,12 @@ class WhisperBase: exception(f'{e=}') raise e - stt = awaitify(_stt) class WhisperFile(WhisperBase): def _stt(self, filepath): return self.model.transcribe(filepath) + stt = awaitify(_stt) class WhisperBase64(WhisperBase): def _stt(self, audio_base64): @@ -45,3 +45,4 @@ class WhisperBase64(WhisperBase): info(f'ndarr={ndarr}') return self.model.transcribe(ndarr) + stt = awaitify(_stt)