This commit is contained in:
yumoqing 2024-08-10 16:58:59 +08:00
parent 77d4c4b2aa
commit f5bc75f183

View File

@ -1,4 +1,5 @@
import os
import time
from traceback import print_exc
import base64
import wave
@ -44,12 +45,17 @@ async def generate(request, kw):
'message':f'model={model} is not defined'
}
try:
txt = await engine.stt(fname)
t1 = time.time()
dic = await engine.stt(fname)
t2 = time.time()
os.remove(fname)
info(f'{txt=}')
return {
"status":"ok",
"content":txt
"time_cost":t2-t1,
"content":dic['text'],
"segments":dic['segments'],
"language":dic['language']
}
except Exception as e:
exception(f'{e}')