This commit is contained in:
yumoqing 2025-11-05 18:06:59 +08:00
parent 5a6f8f462f
commit aa4e878f97
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,8 @@
from appPublic.worker import get_event_loop
from fw.init import load_fastwhisper
from ahserver.webapp import webapp
from ahserver.configuredServer import AHApp
from appPublic.registerfunction import RegisterFunction
async def transcrible(request, *args, **kw):
@ -13,12 +15,20 @@ async def get_status(request, *args, **kw):
ret = await env.fastwhister.get_status(env.params_kw.task_id)
return ret
async def ahapp_built(app):
env = ServerEnv()
app.on_startup.append(env.fastwhisper.run)
def init():
rf = RegisterFunction()
rf.register('transcrible', transcrible)
rf.register('ahapp_built', ahapp_built)
rf.register('get_status', get_status)
load_fastwhisper()
class FastWhisperApp(AHApp):
if __name__ == '__main__':
loop = get_event_loop()
webapp(init)

View File

@ -5,5 +5,4 @@ from appPublic.worker import schedule_once
def load_fastwhisper():
env = ServerEnv()
engine = MyLongTask()
schedule_once(1, engine.run)
env.fastwhisper = engine