nprasad24 commited on
Commit
4bc3117
·
verified ·
1 Parent(s): ed69b0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -76,13 +76,13 @@ def ragChain():
76
 
77
  output: rag chain
78
  """
79
- #loader = TextLoader("knowledgeBase.txt")
80
- #docs = loader.load()
81
 
82
- #text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
83
- #docs = text_splitter.split_documents(docs)
84
 
85
- vectorstore = FAISS.load_local("faiss_index", embeddings = HuggingFaceEmbeddings(), allow_dangerous_deserialization = True)
86
  retriever = vectorstore.as_retriever(search_type = "similarity", search_kwargs = {"k": 5})
87
 
88
  #APIKEY = "o7T3gVx9Vt8GSJbLyPV1974vF8LXVp01CWqOkWQuHgoHm07H"
 
76
 
77
  output: rag chain
78
  """
79
+ loader = TextLoader("knowledgeBase.txt")
80
+ docs = loader.load()
81
 
82
+ text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
83
+ docs = text_splitter.split_documents(docs)
84
 
85
+ vectorstore = FAISS.from_documents(documents = docs, embedding = HuggingFaceEmbeddings())
86
  retriever = vectorstore.as_retriever(search_type = "similarity", search_kwargs = {"k": 5})
87
 
88
  #APIKEY = "o7T3gVx9Vt8GSJbLyPV1974vF8LXVp01CWqOkWQuHgoHm07H"