Files
video-subtitle-remover/backend/tools/model_config.py
flavioy 2d1d3fe37b
Some checks failed
Docker Build and Push / check-secrets (push) Successful in 3s
Docker Build and Push / build-and-push (cpu, latest) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 11.8) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.6) (push) Has been skipped
Docker Build and Push / build-and-push (cuda, 12.8) (push) Has been skipped
Docker Build and Push / build-and-push (directml, latest) (push) Has been skipped
Build Windows CPU / build (push) Has been cancelled
Build Windows CUDA 11.8 / build (push) Has been cancelled
Build Windows CUDA 12.6 / build (push) Has been cancelled
Build Windows CUDA 12.8 / build (push) Has been cancelled
Build Windows DirectML / build (push) Has been cancelled
移除ProPainter模式:删除代码、模型、UI设置和翻译
ProPainter算法占用341MB模型文件且需要大量显存,移除以精简项目。
- 删除 backend/inpaint/propainter_inpaint.py 和 video/ 模块
- 删除 backend/models/propainter/ 模型目录
- 移除 InpaintMode.PROPAINTER 枚举和 propainterMaxLoadNum 配置
- 移除高级设置页面的 ProPainter 设置组
- 清理所有7种语言的翻译文件
- 更新 README 和 .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 20:20:29 +08:00

25 lines
1.2 KiB
Python

import os
from backend.config import config, BASE_DIR
from backend.tools.common_tools import merge_big_file_if_not_exists
from backend.tools.constant import SubtitleDetectMode
_MODEL_NAME_MAP = {
SubtitleDetectMode.PP_OCRv5_MOBILE: "PP-OCRv5_mobile_det",
SubtitleDetectMode.PP_OCRv5_SERVER: "PP-OCRv5_server_det",
}
class ModelConfig:
def __init__(self):
self.LAMA_MODEL_DIR = os.path.join(BASE_DIR, 'models', 'big-lama')
self.STTN_AUTO_MODEL_PATH = os.path.join(BASE_DIR, 'models', 'sttn-auto', 'infer_model.pth')
self.STTN_DET_MODEL_PATH = os.path.join(BASE_DIR, 'models', 'sttn-det', 'sttn.pth')
if config.subtitleDetectMode.value == SubtitleDetectMode.PP_OCRv5_MOBILE:
self.DET_MODEL_DIR = os.path.join(BASE_DIR,'models', 'V5', 'ch_det_fast')
elif config.subtitleDetectMode.value == SubtitleDetectMode.PP_OCRv5_SERVER:
self.DET_MODEL_DIR = os.path.join(BASE_DIR, 'models', 'V5', 'ch_det')
else:
raise ValueError(f"Invalid subtitle detect mode: {config.subtitleDetectMode.value}")
self.DET_MODEL_NAME = _MODEL_NAME_MAP[config.subtitleDetectMode.value]
merge_big_file_if_not_exists(self.LAMA_MODEL_DIR, 'bit-lama.pt')