bugfix
This commit is contained in:
parent
3cd51e3465
commit
ae6e0cfc41
@ -44,7 +44,7 @@ RTCPeerConnection.get_local_candidates = pc_get_local_candidates
|
|||||||
|
|
||||||
class RTCLLM:
|
class RTCLLM:
|
||||||
def __init__(self, ws_url, iceServers):
|
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.ws_url = ws_url
|
||||||
self.iceServers = iceServers
|
self.iceServers = iceServers
|
||||||
self.peers = DictObject()
|
self.peers = DictObject()
|
||||||
@ -101,7 +101,7 @@ class RTCLLM:
|
|||||||
self.onlineList = data.onlineList
|
self.onlineList = data.onlineList
|
||||||
|
|
||||||
async def vad_voiceend(self, peer, audio):
|
async def vad_voiceend(self, peer, audio):
|
||||||
ret = await asr(self.stt_model, audio)
|
ret = await asr(audio)
|
||||||
# await peer.dc.send(txt)
|
# await peer.dc.send(txt)
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ opts = {
|
|||||||
"asr":desc
|
"asr":desc
|
||||||
}
|
}
|
||||||
|
|
||||||
async def asr(model, a_file):
|
async def asr(a_file):
|
||||||
"""
|
|
||||||
oc = OAuthClient(DictObject(**opts))
|
oc = OAuthClient(DictObject(**opts))
|
||||||
r = await oc("http://open-computing.cn", "asr", {"b64audio":audio})
|
with open(a_file, 'rb') as f:
|
||||||
print(f'{r=}')
|
r = await oc("http://open-computing.cn", "asr", {"audio_file":f})
|
||||||
|
print(f'{r=}')
|
||||||
"""
|
"""
|
||||||
segments, info = model.transcribe(a_file, beam_size=5)
|
segments, info = model.transcribe(a_file, beam_size=5)
|
||||||
txt = ''
|
txt = ''
|
||||||
@ -44,3 +44,4 @@ async def asr(model, a_file):
|
|||||||
'content': txt,
|
'content': txt,
|
||||||
'language': info.language
|
'language': info.language
|
||||||
}
|
}
|
||||||
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user