更新文档/升级 faster-whisper 至 v3

This commit is contained in:
linyq 2025-04-26 14:21:37 +08:00
parent 5f778d5b15
commit 42151f8766
4 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@ -32,4 +32,5 @@ resource/fonts/*.ttf
resource/fonts/*.otf
resource/srt/*.srt
app/models/faster-whisper-large-v2/*
app/models/faster-whisper-large-v3/*
app/models/bert/*

View File

@ -4,7 +4,7 @@
<h3 align="center">一站式 AI 影视解说+自动化剪辑工具🎬🎞️ </h3>
<h3>📖 <a href="README-cn.md">English</a> | 简体中文 | <a href="README-ja.md">日本語</a> </h3>
<h3>📖 <a href="README-en.md">English</a> | 简体中文 | <a href="README-ja.md">日本語</a> </h3>
<div align="center">
[//]: # ( <a href="https://trendshift.io/repositories/8731" target="_blank"><img src="https://trendshift.io/api/badge/repositories/8731" alt="harry0703%2FNarratoAI | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>)
@ -83,7 +83,7 @@ _**注意⚠️:近期在 x (推特) 上发现有人冒充作者在 pump.fun
## 配置要求 📦
- 建议最低 CPU 4核或以上内存 8G 或以上,显卡非必须
- Windows 10 或 MacOS 11.0 以上系统
- Windows 10/11 或 MacOS 11.0 以上系统
- [Python 3.10+](https://www.python.org/downloads/)
## 反馈建议 📢

View File

@ -33,7 +33,7 @@ def create(audio_file, subtitle_file: str = ""):
"""
global model, device, compute_type
if not model:
model_path = f"{utils.root_dir()}/app/models/faster-whisper-large-v2"
model_path = f"{utils.root_dir()}/app/models/faster-whisper-large-v3"
model_bin_file = f"{model_path}/model.bin"
if not os.path.isdir(model_path) or not os.path.isfile(model_bin_file):
logger.error(
@ -403,7 +403,7 @@ def extract_audio_and_create_subtitle(video_file: str, subtitle_file: str = "")
logger.info("音频提取完成,开始生成字幕")
# 使用create函数生成字幕
create(audio_file, subtitle_file)
create("/Users/apple/Desktop/WhisperX-zhuanlu/1_qyn2-2_Vocals.wav", subtitle_file)
# 删除临时音频文件
if os.path.exists(audio_file):
@ -422,8 +422,8 @@ if __name__ == "__main__":
task_id = "123456"
task_dir = utils.task_dir(task_id)
subtitle_file = f"{task_dir}/subtitle_123456.srt"
audio_file = f"{task_dir}/audio.wav"
video_file = "/Users/apple/Desktop/home/NarratoAI/resource/videos/merged_video_1702.mp4"
audio_file = "/Users/apple/Desktop/WhisperX-zhuanlu/1_qyn2-2_Vocals.wav"
video_file = "/Users/apple/Desktop/home/NarratoAI/storage/temp/merge/qyn2-2-720p.mp4"
extract_audio_and_create_subtitle(video_file, subtitle_file)