Spaces:
Runtime error
Runtime error
Upload Index.py
Browse files
Index.py
CHANGED
@@ -187,9 +187,11 @@ def _load_embeddings_from_db(
|
|
187 |
embeddings = Embeddings({"path": path, "content": True})
|
188 |
# if Vector DB is not present
|
189 |
if not db_present:
|
|
|
190 |
return embeddings
|
191 |
else:
|
192 |
if domain == "":
|
|
|
193 |
embeddings.load("index") # change this later
|
194 |
else:
|
195 |
print(3)
|
@@ -228,11 +230,13 @@ def rag(domain: str, question: str):
|
|
228 |
# Create extractor instance
|
229 |
#extractor = Extractor(embeddings, "google/flan-t5-base")
|
230 |
#extractor = Extractor(embeddings, "TheBloke/Llama-2-7B-GGUF")
|
|
|
231 |
extractor = Extractor(embeddings, "google/flan-t5-base")
|
232 |
# llm = HuggingFaceHub(
|
233 |
# repo_id="google/flan-t5-xxl",
|
234 |
# model_kwargs={"temperature": 1, "max_length": 1000000},
|
235 |
# )
|
236 |
# else:
|
|
|
237 |
answer = _search(question, extractor)
|
238 |
return {"question": question, "answer": answer}
|
|
|
187 |
embeddings = Embeddings({"path": path, "content": True})
|
188 |
# if Vector DB is not present
|
189 |
if not db_present:
|
190 |
+
print("db not present")
|
191 |
return embeddings
|
192 |
else:
|
193 |
if domain == "":
|
194 |
+
print("domain empty")
|
195 |
embeddings.load("index") # change this later
|
196 |
else:
|
197 |
print(3)
|
|
|
230 |
# Create extractor instance
|
231 |
#extractor = Extractor(embeddings, "google/flan-t5-base")
|
232 |
#extractor = Extractor(embeddings, "TheBloke/Llama-2-7B-GGUF")
|
233 |
+
print("before calling extractor")
|
234 |
extractor = Extractor(embeddings, "google/flan-t5-base")
|
235 |
# llm = HuggingFaceHub(
|
236 |
# repo_id="google/flan-t5-xxl",
|
237 |
# model_kwargs={"temperature": 1, "max_length": 1000000},
|
238 |
# )
|
239 |
# else:
|
240 |
+
print("before doing Q&A")
|
241 |
answer = _search(question, extractor)
|
242 |
return {"question": question, "answer": answer}
|