Skip to content

Commit

Permalink
Merge pull request #208 from Eyobyb/fix/dependency-issue
Browse files Browse the repository at this point in the history
remove pypdf
  • Loading branch information
saminegash authored Nov 1, 2023
2 parents fb498a4 + 9a67128 commit 84f9737
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/sherpa_ai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import sherpa_ai.config as cfg
from sherpa_ai.models.sherpa_base_model import SherpaOpenAI

import PyPDF2
# import PyPDF2
def load_files(files: List[str]) -> List[Document]:
documents = []
loader = None
Expand Down Expand Up @@ -247,12 +247,12 @@ def show_commands_only(logs):
def extract_text_from_pdf(pdf_path):
text = ""
# Extract text from a PDF using PdfReader
pdf_file = open(pdf_path, "rb")
pdf_reader = PyPDF2.PdfReader(pdf_file)
# pdf_file = open(pdf_path, "rb")
# pdf_reader = PyPDF2.PdfReader(pdf_file)

text = ""
for page in pdf_reader.pages:
text += page.extract_text()
# text = ""
# for page in pdf_reader.pages:
# text += page.extract_text()

pdf_file.close()
# pdf_file.close()
return text

0 comments on commit 84f9737

Please sign in to comment.