Mavhas commited on
Commit
0adcf3b
·
verified ·
1 Parent(s): d412dc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,11 +6,14 @@ from langchain.embeddings import SentenceTransformerEmbeddings
6
  from langchain.vectorstores import FAISS
7
  import os
8
  from groq import Groq
 
9
 
10
  # Load PDF (with error handling)
11
  def load_pdf(uploaded_file):
12
  try:
13
- loader = PyPDFLoader(uploaded_file)
 
 
14
  documents = loader.load()
15
  return documents
16
  except Exception as e:
 
6
  from langchain.vectorstores import FAISS
7
  import os
8
  from groq import Groq
9
+ from io import BytesIO
10
 
11
  # Load PDF (with error handling)
12
  def load_pdf(uploaded_file):
13
  try:
14
+ bytes_data = uploaded_file.getvalue()
15
+ pdf_buffer = BytesIO(bytes_data)
16
+ loader = PyPDFLoader(pdf_buffer)
17
  documents = loader.load()
18
  return documents
19
  except Exception as e: