Changes
Browse files
app.py
CHANGED
@@ -105,15 +105,16 @@ def create_upload_file(file: bytes = File(...)):
|
|
105 |
@app.post("/uploadJobDescriptionPDF/")
|
106 |
def upload_PDF(file: UploadFile = File(...)):
|
107 |
try:
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
111 |
except Exception:
|
112 |
return {"message": "There was an error uploading the file"}
|
113 |
finally:
|
114 |
file.file.close()
|
115 |
|
116 |
-
return {"message": f"Successfully uploaded {
|
117 |
|
118 |
@app.post("/uploadJobDescriptionPDF2/")
|
119 |
def process_pdf_file(file: bytes = File(...)):
|
@@ -132,10 +133,10 @@ def process_pdf_file(file: bytes = File(...)):
|
|
132 |
def process_pdf_file2(file: Annotated[bytes, File()]):
|
133 |
# Save file locally for processing
|
134 |
text =''
|
135 |
-
reserve_pdf_on_memory = io.BytesIO(file)
|
136 |
-
load_pdf = PyPDF2.PdfReader(reserve_pdf_on_memory)
|
137 |
-
for page in load_pdf.pages:
|
138 |
-
|
139 |
-
print(text)
|
140 |
# Process saved file
|
141 |
return {"content": file.content_type }
|
|
|
105 |
@app.post("/uploadJobDescriptionPDF/")
|
106 |
def upload_PDF(file: UploadFile = File(...)):
|
107 |
try:
|
108 |
+
load_pdf = PyPDF2.PdfReader(file)
|
109 |
+
for page in load_pdf.pages:
|
110 |
+
text += page.extract_text()
|
111 |
+
print(text)
|
112 |
except Exception:
|
113 |
return {"message": "There was an error uploading the file"}
|
114 |
finally:
|
115 |
file.file.close()
|
116 |
|
117 |
+
return {"message": f"Successfully uploaded {text}"}
|
118 |
|
119 |
@app.post("/uploadJobDescriptionPDF2/")
|
120 |
def process_pdf_file(file: bytes = File(...)):
|
|
|
133 |
def process_pdf_file2(file: Annotated[bytes, File()]):
|
134 |
# Save file locally for processing
|
135 |
text =''
|
136 |
+
#reserve_pdf_on_memory = io.BytesIO(file)
|
137 |
+
#load_pdf = PyPDF2.PdfReader(reserve_pdf_on_memory)
|
138 |
+
#for page in load_pdf.pages:
|
139 |
+
# text += page.extract_text()
|
140 |
+
#print(text)
|
141 |
# Process saved file
|
142 |
return {"content": file.content_type }
|