Pavan178 commited on
Commit
fc39a13
·
verified ·
1 Parent(s): 82e1dd9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -74,15 +74,15 @@ NOTE : DESCRIBE/SUMMARY should always return the overall summary of the document
74
 
75
  self.prompt = PromptTemplate(template=self.template, input_variables=["context", "question"])
76
 
77
- def load_and_process_pdf(self, pdf_path):
78
- try:
79
- loader = PyPDFLoader(pdf_path)
80
- documents = loader.load()
81
- texts = self.text_splitter.split_documents(documents)
82
- self.db = FAISS.from_documents(texts, self.embeddings)
83
- self.setup_conversation_chain()
84
- except Exception as e:
85
- return f"An error occurred while processing the PDF: {e}"
86
 
87
  def setup_conversation_chain(self):
88
  self.qa_chain = ConversationalRetrievalChain.from_llm(
 
74
 
75
  self.prompt = PromptTemplate(template=self.template, input_variables=["context", "question"])
76
 
77
+ def load_and_process_pdf(self, pdf_path):
78
+ try:
79
+ loader = PyPDFLoader(pdf_path)
80
+ documents = loader.load()
81
+ texts = self.text_splitter.split_documents(documents)
82
+ self.db = FAISS.from_documents(texts, self.embeddings)
83
+ self.setup_conversation_chain()
84
+ except Exception as e:
85
+ return f"An error occurred while processing the PDF: {e}"
86
 
87
  def setup_conversation_chain(self):
88
  self.qa_chain = ConversationalRetrievalChain.from_llm(