Spaces:
Sleeping
Sleeping
many changes
Browse files- data/faiss.index +2 -2
- data/index.faiss +0 -0
- main.py +9 -5
data/faiss.index
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 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 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
recommender = QuestionRecommender(
|
| 80 |
-
faiss_index_path=
|
| 81 |
-
questions_path=
|
| 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:
|