Spaces:
Sleeping
Sleeping
Update functions.py
Browse files- functions.py +35 -3
functions.py
CHANGED
|
@@ -385,11 +385,11 @@ class QdrantInterface:
|
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
-
def
|
| 389 |
-
|
| 390 |
|
| 391 |
# File uploader widget
|
| 392 |
-
uploaded_file = st.file_uploader("Upload
|
| 393 |
|
| 394 |
if uploaded_file is not None:
|
| 395 |
# Read PDF file
|
|
@@ -417,6 +417,38 @@ def main():
|
|
| 417 |
mime="text/csv"
|
| 418 |
)
|
| 419 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
def convert_to_csv(text):
|
| 421 |
# Split text into lines and create a DataFrame
|
| 422 |
lines = text.split("\n")
|
|
|
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
+
def resume_pdf():
|
| 389 |
+
|
| 390 |
|
| 391 |
# File uploader widget
|
| 392 |
+
uploaded_file = st.file_uploader("Upload Resumes", type=["pdf"])
|
| 393 |
|
| 394 |
if uploaded_file is not None:
|
| 395 |
# Read PDF file
|
|
|
|
| 417 |
mime="text/csv"
|
| 418 |
)
|
| 419 |
|
| 420 |
+
def resume_pdf():
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
# File uploader widget
|
| 424 |
+
uploaded_file = st.file_uploader("Upload Job Description", type=["pdf"])
|
| 425 |
+
|
| 426 |
+
if uploaded_file is not None:
|
| 427 |
+
# Read PDF file
|
| 428 |
+
pdf_reader = PyPDF2.PdfFileReader(uploaded_file)
|
| 429 |
+
num_pages = pdf_reader.numPages
|
| 430 |
+
|
| 431 |
+
# Extract text from each page
|
| 432 |
+
text = ""
|
| 433 |
+
for page_num in range(num_pages):
|
| 434 |
+
page = pdf_reader.getPage(page_num)
|
| 435 |
+
text += page.extractText()
|
| 436 |
+
|
| 437 |
+
# Convert text to CSV
|
| 438 |
+
csv_data = convert_to_csv(text)
|
| 439 |
+
|
| 440 |
+
# Display or download CSV
|
| 441 |
+
st.subheader("Converted CSV Data")
|
| 442 |
+
st.write(csv_data)
|
| 443 |
+
|
| 444 |
+
# Download link for CSV file
|
| 445 |
+
st.download_button(
|
| 446 |
+
label="Download CSV",
|
| 447 |
+
data=csv_data,
|
| 448 |
+
file_name="converted_data.csv",
|
| 449 |
+
mime="text/csv"
|
| 450 |
+
)
|
| 451 |
+
|
| 452 |
def convert_to_csv(text):
|
| 453 |
# Split text into lines and create a DataFrame
|
| 454 |
lines = text.split("\n")
|