robertselvam commited on
Commit
25d627b
·
verified ·
1 Parent(s): bfe7468

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,6 +6,8 @@ from langchain.memory import ConversationBufferMemory
6
  from langchain.chains import ConversationChain
7
  from langchain.chains import ConversationalRetrievalChain
8
  from langchain.document_loaders import UnstructuredFileLoader
 
 
9
  from typing import List, Dict, Tuple
10
  import gradio as gr
11
  import validators
@@ -45,9 +47,10 @@ class ChatDocumentQA:
45
  List[str]: Extracted text from the PDFs.
46
  """
47
  docs = []
48
- loaders = [UnstructuredFileLoader(file_obj, strategy="fast") for file_obj in file_paths]
49
  for loader in loaders:
50
  docs.extend(loader.load())
 
51
  return docs
52
 
53
  def _get_content_from_url(self, urls: str) -> List[str]:
 
6
  from langchain.chains import ConversationChain
7
  from langchain.chains import ConversationalRetrievalChain
8
  from langchain.document_loaders import UnstructuredFileLoader
9
+ from langchain_community.document_loaders import PyPDFLoader
10
+
11
  from typing import List, Dict, Tuple
12
  import gradio as gr
13
  import validators
 
47
  List[str]: Extracted text from the PDFs.
48
  """
49
  docs = []
50
+ loaders = [PyPDFLoader(file_obj) for file_obj in file_paths]
51
  for loader in loaders:
52
  docs.extend(loader.load())
53
+ print("docs", docs)
54
  return docs
55
 
56
  def _get_content_from_url(self, urls: str) -> List[str]: