Files
BiliNote/backend/app/transcriber/transcriber_provider.py
Jefferyhcool bb974b0b89 :feat 新增模型配置页面和相关功能
- 新增模型配置页面组件和路由
- 实现模型配置表单和相关逻辑- 添加全局配置入口和功能- 优化首页布局和样式- 新增 404 页面组件
- 更新部分组件样式和结构
2025-04-22 17:01:02 +08:00

19 lines
742 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from app.transcriber.whisper import WhisperTranscriber
from app.utils.logger import get_logger
logger = get_logger(__name__)
logger.info('实例化transcriber')
# TODO:后面需要加入逻辑选择
_transcriber = None
def get_transcriber(model_size="base", device="cuda"):
global _transcriber
if _transcriber is None:
logger.info('不存在 transcriber 开始实例化transcriber。')
try:
_transcriber = WhisperTranscriber(model_size=model_size, device=device)
logger.info(f'实例化transcriber成功。参数{model_size}, {device} ')
except Exception as e:
logger.error(f"实例化transcriber失败请检查是否安装whisper。{e}")
return _transcriber