Arafath10 commited on
Commit
c6a4a5b
·
verified ·
1 Parent(s): 6741737

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -7
main.py CHANGED
@@ -87,13 +87,13 @@ async def get_data(input_file: UploadFile = File(...)):
87
  text = ""
88
 
89
  if file_type == "application/pdf":
90
- if text=="":
91
- text = vision(file_content)
92
- # else:
93
- # # Read PDF file using PyPDF2
94
- # pdf_reader = PdfReader(io.BytesIO(file_content))
95
- # for page in pdf_reader.pages:
96
- # text += page.extract_text()
97
  else:
98
  raise HTTPException(status_code=400, detail="Unsupported file type")
99
 
 
87
  text = ""
88
 
89
  if file_type == "application/pdf":
90
+ # Read PDF file using PyPDF2
91
+ pdf_reader = PdfReader(io.BytesIO(file_content))
92
+ for page in pdf_reader.pages:
93
+ text += page.extract_text()
94
+
95
+ if text=="":
96
+ text = vision(file_content)
97
  else:
98
  raise HTTPException(status_code=400, detail="Unsupported file type")
99