Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,24 +26,40 @@ def load_vectorstore():
|
|
26 |
model_name="sentence-transformers/all-MiniLM-L6-v2"
|
27 |
)
|
28 |
|
29 |
-
#
|
30 |
-
|
31 |
-
print(f"
|
32 |
|
33 |
-
#
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
vectorstore = FAISS.load_local(
|
39 |
-
|
40 |
embeddings,
|
41 |
allow_dangerous_deserialization=True
|
42 |
)
|
43 |
print("✅ 벡터스토어 로드 완료")
|
|
|
44 |
except Exception as e:
|
45 |
print(f"❌ 벡터스토어 로드 실패: {e}")
|
46 |
-
|
|
|
47 |
vectorstore = None
|
48 |
|
49 |
return vectorstore
|
|
|
26 |
model_name="sentence-transformers/all-MiniLM-L6-v2"
|
27 |
)
|
28 |
|
29 |
+
# 절대 경로로 확인
|
30 |
+
vectorstore_path = os.path.join(os.getcwd(), "vectorstore")
|
31 |
+
print(f"벡터스토어 경로: {vectorstore_path}")
|
32 |
|
33 |
+
# 필수 파일들 확인
|
34 |
+
required_files = ["index.faiss", "index.pkl"]
|
35 |
+
missing_files = []
|
36 |
+
|
37 |
+
if os.path.exists(vectorstore_path):
|
38 |
+
existing_files = os.listdir(vectorstore_path)
|
39 |
+
print(f"존재하는 파일들: {existing_files}")
|
40 |
+
|
41 |
+
for file in required_files:
|
42 |
+
if file not in existing_files:
|
43 |
+
missing_files.append(file)
|
44 |
+
|
45 |
+
if missing_files:
|
46 |
+
print(f"❌ 누락된 파일들: {missing_files}")
|
47 |
+
return None
|
48 |
+
else:
|
49 |
+
print("❌ vectorstore 폴더가 존재하지 않습니다")
|
50 |
+
return None
|
51 |
|
52 |
vectorstore = FAISS.load_local(
|
53 |
+
vectorstore_path,
|
54 |
embeddings,
|
55 |
allow_dangerous_deserialization=True
|
56 |
)
|
57 |
print("✅ 벡터스토어 로드 완료")
|
58 |
+
|
59 |
except Exception as e:
|
60 |
print(f"❌ 벡터스토어 로드 실패: {e}")
|
61 |
+
import traceback
|
62 |
+
traceback.print_exc()
|
63 |
vectorstore = None
|
64 |
|
65 |
return vectorstore
|