This commit is contained in:
yumoqing 2024-09-07 11:25:47 +08:00
parent 4029d35cf8
commit b6c93d375d

View File

@ -3,7 +3,7 @@ from appPublic.dictObject import DictObject
from appPublic.oauth_client import OAuthClient from appPublic.oauth_client import OAuthClient
desc = { desc = {
"path":"/asr/generate", "path":"/api/generate",
"method":"POST", "method":"POST",
"headers":[ "headers":[
{ {
@ -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('https://sage.open-computing.cn', 'asr', {'audio_file':f}) r = await oc('https://sage.open-computing.cn/asr', '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("https://sage.open-computing.cn/asr/generate", data={ async with session.post("https://sage.open-computing.cn/asr/api/generate.dspy", data={
"model":"whisper", "model":"whisper",
"audio_file":f "audio_file":f
}) as response: }) as response: