This commit is contained in:
yumoqing 2024-09-04 19:50:25 +08:00
parent a8bb8edef5
commit 08a43e722f

View File

@ -36,10 +36,13 @@ opts = {
async def asr(a_file): async def asr(a_file):
if not a_file: if not a_file:
return return
r = None
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('http://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("http://open-computing.cn/asr/generate", data={