harithapliyal commited on
Commit
7e1608f
·
1 Parent(s): 55ed6a2

Update Hugging Face username in vector db loading

Browse files
Files changed (1) hide show
  1. osho_qa_service.py +4 -0
osho_qa_service.py CHANGED
@@ -60,6 +60,10 @@ def get_answer_from_osho(question: str, n_results: int = 5) -> Dict:
60
  """
61
  # Initialize ChromaDB client
62
  db_dir = os.path.join(os.getcwd(), "vector_db")
 
 
 
 
63
  client = chromadb.PersistentClient(path=db_dir)
64
 
65
  # Initialize embedding function
 
60
  """
61
  # Initialize ChromaDB client
62
  db_dir = os.path.join(os.getcwd(), "vector_db")
63
+ if not os.path.exists(db_dir):
64
+ # If local path doesn't exist, download from Hugging Face
65
+ from huggingface_hub import snapshot_download
66
+ db_dir = snapshot_download(repo_id="harithapliyal/osho-vector-db")
67
  client = chromadb.PersistentClient(path=db_dir)
68
 
69
  # Initialize embedding function