This commit is contained in:
yumoqing 2024-09-04 18:53:44 +08:00
parent 3cd51e3465
commit ae6e0cfc41
2 changed files with 7 additions and 6 deletions

View File

@ -44,7 +44,7 @@ RTCPeerConnection.get_local_candidates = pc_get_local_candidates
class RTCLLM:
def __init__(self, ws_url, iceServers):
self.stt_model = WhisperModel('large-v3', device="cuda", compute_type="float16")
# self.stt_model = WhisperModel('large-v3', device="cuda", compute_type="float16")
self.ws_url = ws_url
self.iceServers = iceServers
self.peers = DictObject()
@ -101,7 +101,7 @@ class RTCLLM:
self.onlineList = data.onlineList
async def vad_voiceend(self, peer, audio):
ret = await asr(self.stt_model, audio)
ret = await asr(audio)
# await peer.dc.send(txt)

View File

@ -30,10 +30,10 @@ opts = {
"asr":desc
}
async def asr(model, a_file):
"""
async def asr(a_file):
oc = OAuthClient(DictObject(**opts))
r = await oc("http://open-computing.cn", "asr", {"b64audio":audio})
with open(a_file, 'rb') as f:
r = await oc("http://open-computing.cn", "asr", {"audio_file":f})
print(f'{r=}')
"""
segments, info = model.transcribe(a_file, beam_size=5)
@ -44,3 +44,4 @@ async def asr(model, a_file):
'content': txt,
'language': info.language
}
"""