Spaces:
Sleeping
Sleeping
Update functions.py
Browse files- functions.py +17 -5
functions.py
CHANGED
|
@@ -409,21 +409,33 @@ def resume_pdf():
|
|
| 409 |
# Allow user to upload multiple PDF files
|
| 410 |
uploaded_files = st.file_uploader("Upload PDF files", type="pdf")
|
| 411 |
|
|
|
|
| 412 |
if uploaded_files:
|
| 413 |
st.write("## Extracted Text from PDFs")
|
| 414 |
df_rows = []
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
for uploaded_file in uploaded_files:
|
| 418 |
text = extract_text_from_pdf(uploaded_file)
|
| 419 |
|
| 420 |
# Add text to DataFrame
|
| 421 |
-
df_rows.append({"File Name":
|
| 422 |
|
| 423 |
# Display extracted text
|
| 424 |
-
st.write(f"### {
|
| 425 |
st.write(text)
|
| 426 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 427 |
# Create DataFrame
|
| 428 |
df = pd.DataFrame(df_rows)
|
| 429 |
|
|
|
|
| 409 |
# Allow user to upload multiple PDF files
|
| 410 |
uploaded_files = st.file_uploader("Upload PDF files", type="pdf")
|
| 411 |
|
| 412 |
+
|
| 413 |
if uploaded_files:
|
| 414 |
st.write("## Extracted Text from PDFs")
|
| 415 |
df_rows = []
|
| 416 |
+
# Iterate over uploaded PDF files
|
| 417 |
+
for idx, uploaded_file in enumerate(uploaded_files):
|
|
|
|
| 418 |
text = extract_text_from_pdf(uploaded_file)
|
| 419 |
|
| 420 |
# Add text to DataFrame
|
| 421 |
+
df_rows.append({"File Name": f"File_{idx+1}", "Text": text})
|
| 422 |
|
| 423 |
# Display extracted text
|
| 424 |
+
st.write(f"### File {idx+1}")
|
| 425 |
st.write(text)
|
| 426 |
|
| 427 |
+
|
| 428 |
+
# # Iterate over uploaded PDF files
|
| 429 |
+
# for uploaded_file in uploaded_files:
|
| 430 |
+
# text = extract_text_from_pdf(uploaded_file)
|
| 431 |
+
|
| 432 |
+
# # Add text to DataFrame
|
| 433 |
+
# df_rows.append({"File Name": uploaded_file.name, "Text": text.decode("utf-8")})
|
| 434 |
+
|
| 435 |
+
# # Display extracted text
|
| 436 |
+
# st.write(f"### {uploaded_file.name}")
|
| 437 |
+
# st.write(text)
|
| 438 |
+
|
| 439 |
# Create DataFrame
|
| 440 |
df = pd.DataFrame(df_rows)
|
| 441 |
|