settings.py中增加推理模型路径。

This commit is contained in:
zhanghuan
2025-09-10 15:12:45 +08:00
parent 5f62c6e2e0
commit 2412c26342
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -14,6 +14,7 @@ from tkinterdnd2 import DND_FILES, TkinterDnD
import threading
import time
from net import create_food_cnn
from settings import settings
# 设置customtkinter的外观
ctk.set_appearance_mode("System")
@@ -54,7 +55,7 @@ class FoodClassifierApp:
def load_model(self):
"""加载训练好的PyTorch模型"""
try:
model_path = "../model/02/best_food_model.pth"
model_path = settings.INFERENCE_BEST_MODEL_PATH
if os.path.exists(model_path):
# 创建模型实例
self.model = create_food_cnn()