This commit is contained in:
yumoqing 2024-09-06 18:16:24 +08:00
parent fed1b506c6
commit 4029d35cf8
2 changed files with 4 additions and 5 deletions

View File

@ -2,8 +2,6 @@ import asyncio
import random
import json
from faster_whisper import WhisperModel
from functools import partial
from appPublic.dictObject import DictObject
@ -13,7 +11,8 @@ from aiortc.sdp import candidate_from_sdp, candidate_to_sdp
from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder, MediaRelay
# from websockets.asyncio.client import connect
from websockets.asyncio.client import connect
# from websockets.asyncio.client import connect
from websockets.client import connect
import websockets
from stt import asr
from vad import AudioTrackVad

View File

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