resberry commited on
Commit
5ff9716
·
verified ·
1 Parent(s): abe5e01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -30,7 +30,8 @@ HF_TOKEN = os.getenv("HF_TOKEN", None)
30
 
31
  ADAPTER_DIR = "adapter_refined_v10"
32
 
33
- RAG_DIR = "RAGMaterials"
 
34
  FAISS_INDEX_PATH = os.path.join(RAG_DIR, "ecg_rag.index")
35
  META_PATH = os.path.join(RAG_DIR, "ecg_rag_meta.pkl")
36
  CONFIG_PATH = os.path.join(RAG_DIR, "ecg_rag_config.json")
@@ -211,13 +212,21 @@ def load_rag():
211
  return index, store["docs"], store["meta"]
212
 
213
  if not ALLOW_REBUILD_FROM_CSV:
214
- raise RuntimeError("Missing ecg_rag.index or ecg_rag_meta.pkl in RAGMaterials/.")
215
 
216
  if not os.path.exists(DATA_CSV):
217
- raise RuntimeError("Missing ECG_RAG_only_clean.csv in RAGMaterials/.")
218
 
219
  return build_rag_from_csv(DATA_CSV)
220
 
 
 
 
 
 
 
 
 
221
  index, docs, meta = load_rag()
222
  print("RAG loaded.")
223
 
 
30
 
31
  ADAPTER_DIR = "adapter_refined_v10"
32
 
33
+ # IMPORTANT: this must match your actual folder name in the Space repo
34
+ RAG_DIR = "RAGmaterials"
35
  FAISS_INDEX_PATH = os.path.join(RAG_DIR, "ecg_rag.index")
36
  META_PATH = os.path.join(RAG_DIR, "ecg_rag_meta.pkl")
37
  CONFIG_PATH = os.path.join(RAG_DIR, "ecg_rag_config.json")
 
212
  return index, store["docs"], store["meta"]
213
 
214
  if not ALLOW_REBUILD_FROM_CSV:
215
+ raise RuntimeError("Missing ecg_rag.index or ecg_rag_meta.pkl in RAGmaterials/.")
216
 
217
  if not os.path.exists(DATA_CSV):
218
+ raise RuntimeError("Missing ECG_RAG_only_clean.csv in RAGmaterials/.")
219
 
220
  return build_rag_from_csv(DATA_CSV)
221
 
222
+ print("Checking files...")
223
+ print("BASE_MODEL_PATH:", BASE_MODEL_PATH)
224
+ print("ADAPTER_DIR:", ADAPTER_DIR, os.path.exists(ADAPTER_DIR))
225
+ print("FAISS_INDEX_PATH:", FAISS_INDEX_PATH, os.path.exists(FAISS_INDEX_PATH))
226
+ print("META_PATH:", META_PATH, os.path.exists(META_PATH))
227
+ print("CONFIG_PATH:", CONFIG_PATH, os.path.exists(CONFIG_PATH))
228
+ print("DATA_CSV:", DATA_CSV, os.path.exists(DATA_CSV))
229
+
230
  index, docs, meta = load_rag()
231
  print("RAG loaded.")
232