mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-27 22:34:46 +08:00
feat(engine): 重构字幕引擎并实现 WebSocket 通信
- 重构了 Gummy 和 Vosk 字幕引擎的代码,提高了可扩展性和可读性 - 合并 Gummy 和 Vosk 引擎为单个可执行文件 - 实现了字幕引擎和主程序之间的 WebSocket 通信,避免了孤儿进程问题
This commit is contained in:
@@ -62,7 +62,7 @@ class Callback(TranslationRecognizerCallback):
|
||||
stdout_obj(caption)
|
||||
|
||||
|
||||
class GummyTranslator:
|
||||
class GummyRecognizer:
|
||||
"""
|
||||
使用 Gummy 引擎流式处理的音频数据,并在标准输出中输出与 Auto Caption 软件可读取的 JSON 字符串数据
|
||||
|
||||
@@ -70,6 +70,7 @@ class GummyTranslator:
|
||||
rate: 音频采样率
|
||||
source: 源语言代码字符串(zh, en, ja 等)
|
||||
target: 目标语言代码字符串(zh, en, ja 等)
|
||||
api_key: 阿里云百炼平台 API KEY
|
||||
"""
|
||||
def __init__(self, rate: int, source: str, target: str | None, api_key: str | None):
|
||||
if api_key:
|
||||
|
||||
Reference in New Issue
Block a user