From aa4e878f974d002b17d87f487c5cf858614a9b99 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 5 Nov 2025 18:06:59 +0800 Subject: [PATCH] bugfix --- app/fastwhisper.py | 10 ++++++++++ fw/init.py | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/fastwhisper.py b/app/fastwhisper.py index f48c37d..e0f2506 100644 --- a/app/fastwhisper.py +++ b/app/fastwhisper.py @@ -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) diff --git a/fw/init.py b/fw/init.py index 1c61194..d973f0d 100644 --- a/fw/init.py +++ b/fw/init.py @@ -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