This commit is contained in:
yumoqing 2024-09-06 10:25:28 +08:00
parent 08a43e722f
commit bf2ed8e437
2 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ class RTCLLM:
pc = peer.pc pc = peer.pc
if track.kind == 'audio': if track.kind == 'audio':
f = partial(self.vad_voiceend, peer) f = partial(self.vad_voiceend, peer)
vadtrack = AudioTrackVad(track, stage=0, onvoiceend=f) vadtrack = AudioTrackVad(track, stage=2, onvoiceend=f)
peer.vadtrack = vadtrack peer.vadtrack = vadtrack
vadtrack.start_vad() vadtrack.start_vad()

View File

@ -39,13 +39,13 @@ async def asr(a_file):
r = None r = None
with open(a_file, 'rb') as f: with open(a_file, 'rb') as f:
oc = OAuthClient(DictObject(**opts)) oc = OAuthClient(DictObject(**opts))
r = await oc('http://open-computing.cn', 'asr', {'audio_file':f}) r = await oc('https://open-computing.cn', 'asr', {'audio_file':f})
print(f'{r=}') print(f'{r=}')
return r return r
with open(a_file, 'rb') as f: with open(a_file, 'rb') as f:
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.post("http://open-computing.cn/asr/generate", data={ async with session.post("https://open-computing.cn/asr/generate", data={
"model":"whisper", "model":"whisper",
"audio_file":f "audio_file":f
}) as response: }) as response: