from app.utils.MyBatchOnnxYolo import MyBatchOnnxYolo from app.utils.MyViTFeatureExtractor import MyViTFeatureExtractor from app.core.config import settings class GlobalModels: yolo: MyBatchOnnxYolo = None vit: MyViTFeatureExtractor = None @classmethod def load_models(cls): print("⏳ Loading YOLO Model...") cls.yolo = MyBatchOnnxYolo(settings.YOLO_MODEL_PATH, task='segment') # 或 detect print("⏳ Loading ViT Model...") cls.vit = MyViTFeatureExtractor(settings.VIT_MODEL_PATH) print("✅ Models Loaded Successfully.") global_models = GlobalModels()