This commit is contained in:
yumoqing 2024-08-06 11:31:01 +08:00
parent 5776c05bda
commit 83388ba0cc

View File

@ -39,10 +39,15 @@ class WhisperFile(WhisperBase):
stt = awaitify(_stt) stt = awaitify(_stt)
class WhisperBase64(WhisperBase): class WhisperBase64(WhisperBase):
def _stt(self, audio_base64): def _stt(self, audio):
audiolist = audio.values()
nparr = np.array(audiolist)
"""
raw = base64_decode(audio_base64) raw = base64_decode(audio_base64)
ndarr = np.frombuffer(raw, dtype=np.float32) ndarr = np.frombuffer(raw, dtype=np.float32)
info(f'ndarr={ndarr}') """
return self.model.transcribe(ndarr) info(f'ndarr={nparr}')
return self.model.transcribe(nparr)
stt = awaitify(_stt) stt = awaitify(_stt)