|
@@ -6,7 +6,6 @@ from concurrent.futures import ThreadPoolExecutor
|
|
|
|
|
|
|
|
import service.pyav as pyav
|
|
import service.pyav as pyav
|
|
|
import service.pygpu as pygpu
|
|
import service.pygpu as pygpu
|
|
|
-import service.ai_text_ollama as ai_text
|
|
|
|
|
import service.ai_asr as pyasr
|
|
import service.ai_asr as pyasr
|
|
|
from setting import OUTPUT_DIR
|
|
from setting import OUTPUT_DIR
|
|
|
|
|
|
|
@@ -15,7 +14,10 @@ executor = ThreadPoolExecutor(max_workers=1)
|
|
|
task_queue = asyncio.Queue()
|
|
task_queue = asyncio.Queue()
|
|
|
|
|
|
|
|
async def start_worker():
|
|
async def start_worker():
|
|
|
- asyncio.create_task(gpu_worker()) # 开启 Worker
|
|
|
|
|
|
|
+ # 开启 funasr 初始化任务
|
|
|
|
|
+ asyncio.create_task(pyasr.init_funasr())
|
|
|
|
|
+ # 开启 Worker
|
|
|
|
|
+ asyncio.create_task(gpu_worker())
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- 后台工作进程 (Consumer) ---
|
|
# --- 后台工作进程 (Consumer) ---
|
|
@@ -71,9 +73,6 @@ async def gpu_worker():
|
|
|
async def put_task(task_id, save_path, srt_path, video_path):
|
|
async def put_task(task_id, save_path, srt_path, video_path):
|
|
|
await task_queue.put((task_id, save_path, srt_path, video_path))
|
|
await task_queue.put((task_id, save_path, srt_path, video_path))
|
|
|
|
|
|
|
|
|
|
+
|
|
|
def get_tasks():
|
|
def get_tasks():
|
|
|
return task_queue.qsize()
|
|
return task_queue.qsize()
|
|
|
-
|
|
|
|
|
-def translate_to_zh(text):
|
|
|
|
|
- result = ai_text.translate2zh(text)
|
|
|
|
|
- return result
|
|
|