Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,12 +23,12 @@ def get_pdf_text(pdf_docs : list) -> str:
|
|
23 |
for page in pdf_reader.pages:
|
24 |
text += page.extract_text()
|
25 |
return text
|
26 |
-
|
27 |
def load_file():
|
28 |
loader = TextLoader('d2.txt')
|
29 |
documents = loader.load()
|
30 |
return documents
|
31 |
-
|
32 |
def get_text_chunks(text:str) ->list:
|
33 |
text_splitter = CharacterTextSplitter(
|
34 |
separator="\n", chunk_size=1000, chunk_overlap=100, length_function=len
|
@@ -58,7 +58,7 @@ def get_conversation_chain(vectorstore:FAISS) -> ConversationalRetrievalChain:
|
|
58 |
model_kwargs={"temperature": 0.9, "max_length": 2048},
|
59 |
)
|
60 |
|
61 |
-
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=
|
62 |
conversation_chain = ConversationalRetrievalChain.from_llm(
|
63 |
llm=llm, retriever=vectorstore.as_retriever(),memory=memory
|
64 |
)
|
|
|
23 |
for page in pdf_reader.pages:
|
24 |
text += page.extract_text()
|
25 |
return text
|
26 |
+
#######################################################################################
|
27 |
def load_file():
|
28 |
loader = TextLoader('d2.txt')
|
29 |
documents = loader.load()
|
30 |
return documents
|
31 |
+
########################################################################################
|
32 |
def get_text_chunks(text:str) ->list:
|
33 |
text_splitter = CharacterTextSplitter(
|
34 |
separator="\n", chunk_size=1000, chunk_overlap=100, length_function=len
|
|
|
58 |
model_kwargs={"temperature": 0.9, "max_length": 2048},
|
59 |
)
|
60 |
|
61 |
+
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
62 |
conversation_chain = ConversationalRetrievalChain.from_llm(
|
63 |
llm=llm, retriever=vectorstore.as_retriever(),memory=memory
|
64 |
)
|