bugfix
This commit is contained in:
parent
9326d71435
commit
0850773faa
@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import json
|
||||||
from appPublic.worker import get_event_loop
|
from appPublic.worker import get_event_loop
|
||||||
from appPublic.log import debug
|
from appPublic.log import debug
|
||||||
from fw.init import load_fastwhisper
|
from fw.init import load_fastwhisper
|
||||||
@ -15,9 +16,18 @@ async def transcribe(request, *args, **kw):
|
|||||||
async def get_status(request, *args, **kw):
|
async def get_status(request, *args, **kw):
|
||||||
env = request._run_ns
|
env = request._run_ns
|
||||||
debug(f'get_status():{env.params_kw.task_id=}')
|
debug(f'get_status():{env.params_kw.task_id=}')
|
||||||
ret = await env.fastwhisper.get_status(env.params_kw.task_id)
|
data = await env.fastwhisper.get_status(env.params_kw.task_id)
|
||||||
|
if isinstance(data['result'], str):
|
||||||
|
data['result'] = json.loads(data['result'])
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
async def asr(request, *args, **kw):
|
||||||
|
env = request._run_ns
|
||||||
|
ret = await env.fastwhisper.submit_task(env.params_kw)
|
||||||
|
data = await env.fastwhisper.get_status(ret['task_id'])
|
||||||
|
data['result'] = json.loads(data['result'])
|
||||||
|
return data
|
||||||
|
|
||||||
async def start_fw_server(*args, **kw):
|
async def start_fw_server(*args, **kw):
|
||||||
debug(f'start fastwhisper engine, {args=}, {kw=}')
|
debug(f'start fastwhisper engine, {args=}, {kw=}')
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
@ -30,6 +40,7 @@ async def ahapp_built(app):
|
|||||||
|
|
||||||
def init():
|
def init():
|
||||||
rf = RegisterFunction()
|
rf = RegisterFunction()
|
||||||
|
rf.register('asr', asr)
|
||||||
rf.register('transcribe', transcribe)
|
rf.register('transcribe', transcribe)
|
||||||
rf.register('ahapp_built', ahapp_built)
|
rf.register('ahapp_built', ahapp_built)
|
||||||
rf.register('get_status', get_status)
|
rf.register('get_status', get_status)
|
||||||
|
|||||||
@ -26,6 +26,9 @@
|
|||||||
{
|
{
|
||||||
"leading":"/idfile",
|
"leading":"/idfile",
|
||||||
"registerfunction":"idfile"
|
"registerfunction":"idfile"
|
||||||
|
},{
|
||||||
|
"leading": "/v1/asr",
|
||||||
|
"registerfunction": "asr"
|
||||||
},{
|
},{
|
||||||
"leading": "/v1/transcribe",
|
"leading": "/v1/transcribe",
|
||||||
"registerfunction": "transcribe"
|
"registerfunction": "transcribe"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user