Saran08 commited on
Commit
d149b40
Β·
1 Parent(s): 03d0d75

many changes

Browse files
Files changed (3) hide show
  1. data/faiss.index +2 -2
  2. data/index.faiss +0 -0
  3. main.py +9 -5
data/faiss.index CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5ceae1be47ca3532850ba006eaa2b4e875f21861d2ec6a8b88ac5b7930190eaa
3
- size 614445
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eba4264c9de4ee6c5833975c1168057e28c3dfa3ce75f85dba7df5a529afa806
3
+ size 77869
data/index.faiss DELETED
Binary file (77.9 kB)
 
main.py CHANGED
@@ -9,6 +9,7 @@ from deep_translator import GoogleTranslator
9
  from rag_chatbot import RAGChatBot
10
  from recommender import QuestionRecommender
11
  from langchain_huggingface import HuggingFaceEmbeddings
 
12
 
13
  app = FastAPI(
14
  title="Sat2Farm AI Assistant API",
@@ -74,14 +75,17 @@ async def startup_event():
74
  print("Loading RAG ChatBot...")
75
  bot = RAGChatBot(embeddings) # βœ… FIXED
76
 
77
- # 3. Initialize the Question Recommender
78
- print("Loading Question Recommender...")
 
 
 
 
79
  recommender = QuestionRecommender(
80
- faiss_index_path="data\index.faiss",
81
- questions_path="data/questions.npy",
82
  embedding_model=embeddings
83
  )
84
-
85
  print("πŸŽ‰ All models loaded successfully! API is ready. πŸŽ‰")
86
 
87
  except Exception as e:
 
9
  from rag_chatbot import RAGChatBot
10
  from recommender import QuestionRecommender
11
  from langchain_huggingface import HuggingFaceEmbeddings
12
+ import os
13
 
14
  app = FastAPI(
15
  title="Sat2Farm AI Assistant API",
 
75
  print("Loading RAG ChatBot...")
76
  bot = RAGChatBot(embeddings) # βœ… FIXED
77
 
78
+ faiss_path = os.path.join("data", "faiss.index") # Corrected name to match your file
79
+ questions_path = os.path.join("data", "questions.npy")
80
+
81
+ print(f"Attempting to load Recommender index from: '{faiss_path}'") # Add for debugging
82
+
83
+ # Initialize the Question Recommender with the corrected paths
84
  recommender = QuestionRecommender(
85
+ faiss_index_path=faiss_path,
86
+ questions_path=questions_path,
87
  embedding_model=embeddings
88
  )
 
89
  print("πŸŽ‰ All models loaded successfully! API is ready. πŸŽ‰")
90
 
91
  except Exception as e: