feat(deep_analyzer): 使用SRT简化时间格式 + 分块分析 + 纯文本AI
- 添加 load_srt() 支持 SRT 字幕格式 - 时间格式简化为 HH:MM:SS - 超过3000字自动分块分析 - _merge_summaries 改用纯文本而非JSON - 添加提取函数解析AI响应
This commit is contained in:
@@ -127,11 +127,13 @@ def run_diarization(audio_path, num_speakers=None):
|
||||
raise RuntimeError("需要设置 HF_TOKEN 环境变量\n"
|
||||
"获取方式: https://huggingface.co/settings/tokens")
|
||||
|
||||
# 新版 pyannote 需要先登录
|
||||
from huggingface_hub import login
|
||||
print("登录 HuggingFace...")
|
||||
login(token=hf_token)
|
||||
|
||||
print("加载 pyannote 流水线...")
|
||||
pipeline = Pipeline.from_pretrained(
|
||||
"pyannote/speaker-diarization",
|
||||
use_auth_token=hf_token
|
||||
)
|
||||
pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization")
|
||||
|
||||
# 设置设备
|
||||
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
||||
|
||||
Reference in New Issue
Block a user