修改配置路径

This commit is contained in:
2025-10-11 17:39:57 +08:00
parent 2660d503d6
commit b62a64033a
4 changed files with 14 additions and 7 deletions
+6 -2
View File
@@ -61,10 +61,14 @@ class EmbeddingFoodClassifierApp:
"""加载训练好的embedding模型和FAISS索引"""
try:
# 模型路径
model_path = "../model/embedding_20251010_111257/best_embedding_model.pth"
# 获取当前脚本所在目录
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# model_path = "../model/embedding_20251011_133653/best_embedding_model.pth"
model_path = os.path.join(BASE_DIR, "../model/embedding_20251011_133653/best_embedding_model.pth")
# FAISS索引目录
index_dir = "../faiss_vector_db/faiss_index"
# index_dir = "../faiss_vector_db/faiss_index"
index_dir = os.path.join(BASE_DIR, "../faiss_vector_db/faiss_index")
if os.path.exists(model_path) and os.path.exists(index_dir):
# 1. 加载embedding模型