This commit is contained in:
yumoqing 2024-09-04 19:26:26 +08:00
parent 2becd0724b
commit 1d2af1a159

View File

@ -1,3 +1,4 @@
import aiohttp
from appPublic.dictObject import DictObject
from appPublic.oauth_client import OAuthClient
@ -35,8 +36,14 @@ opts = {
async def asr(a_file):
oc = OAuthClient(DictObject(**opts))
with open(a_file, 'rb') as f:
r = await oc("http://open-computing.cn", "asr", {"audio_file":f})
async with aiohttp.ClientSession() as session:
async with session.post("http://open-computing.cn/asr/generate", data={
"model":"whisper",
"audio_file":f
}) as response:
r = await response.json()
print(f'{r=}')
return r
"""
segments, info = model.transcribe(a_file, beam_size=5)
txt = ''