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") |