fahmiaziz98 commited on
Commit
49b3990
·
1 Parent(s): ec1bd25
Files changed (1) hide show
  1. bot.py +2 -2
bot.py CHANGED
@@ -152,7 +152,7 @@ class PDFChatBot:
152
  Args:
153
  file: File object for the uploaded PDF.
154
  """
155
- loader = PyPDFLoader(file.name)
156
  self.documents = loader.load()
157
  self._initialize_embeddings()
158
  self._initialize_retriever()
@@ -216,7 +216,7 @@ class PDFChatBot:
216
  Returns:
217
  PIL.Image.Image: Rendered image of the current page.
218
  """
219
- doc = fitz.open(file.name)
220
  page = doc[self.current_page]
221
  pix = page.get_pixmap(matrix=fitz.Matrix(300 / 72, 300 / 72))
222
  return Image.frombytes("RGB", [pix.width, pix.height], pix.samples)
 
152
  Args:
153
  file: File object for the uploaded PDF.
154
  """
155
+ loader = PyPDFLoader(file)
156
  self.documents = loader.load()
157
  self._initialize_embeddings()
158
  self._initialize_retriever()
 
216
  Returns:
217
  PIL.Image.Image: Rendered image of the current page.
218
  """
219
+ doc = fitz.open(file)
220
  page = doc[self.current_page]
221
  pix = page.get_pixmap(matrix=fitz.Matrix(300 / 72, 300 / 72))
222
  return Image.frombytes("RGB", [pix.width, pix.height], pix.samples)