mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-08-28 19:46:57 +08:00
feat(transcriber): 更新转录器支持和模型下载逻辑
- 修改 NoteGenerator 类以支持动态选择转录器类型。 - 更新 MLXWhisperTranscriber 类,添加模型下载逻辑,确保模型存在时自动下载。 - 在 transcriber_provider.py 中优化 MLX Whisper 的环境变量处理,确保在不可用时回退到 fast-whisper。
This commit is contained in:
@@ -18,7 +18,7 @@ from app.models.notes_model import AudioDownloadResult
|
||||
from app.enmus.note_enums import DownloadQuality
|
||||
from app.models.transcriber_model import TranscriptResult
|
||||
from app.transcriber.base import Transcriber
|
||||
from app.transcriber.transcriber_provider import get_transcriber
|
||||
from app.transcriber.transcriber_provider import get_transcriber,_transcribers
|
||||
from app.transcriber.whisper import WhisperTranscriber
|
||||
import re
|
||||
|
||||
@@ -89,9 +89,9 @@ class NoteGenerator:
|
||||
:param transcriber: 选择的转义器
|
||||
:return:
|
||||
'''
|
||||
if self.transcriber_type == 'fast-whisper':
|
||||
logger.info("使用Whisper")
|
||||
return get_transcriber(transcriber_type='fast-whisper')
|
||||
if self.transcriber_type in _transcribers.keys():
|
||||
logger.info(f"使用{self.transcriber_type}转义器")
|
||||
return get_transcriber(transcriber_type=self.transcriber_type)
|
||||
else:
|
||||
logger.warning("不支持的转义器")
|
||||
raise ValueError(f"不支持的转义器:{self.transcriber}")
|
||||
|
||||
Reference in New Issue
Block a user