Project / app_func.py
SorterSon's picture
files uploaded
9dca909 verified
raw
history blame contribute delete
333 Bytes
import PyPDF2
def read_uploaded_doc(uploaded_doc):
# if uploaded_doc.type == "aplication/pdf":
reader = PyPDF2.PdfReader(uploaded_doc)
text = ""
for page in reader.pages:
text += page.extract_text()
return text
# else: # Assuming text file
# return str(uploaded_doc.read(), "utf-8")