Spaces:
Sleeping
Sleeping
Update src/PDFprocess_sample.py
Browse files- src/PDFprocess_sample.py +5 -4
src/PDFprocess_sample.py
CHANGED
|
@@ -17,15 +17,16 @@ def process_pdf(uploaded_file):
|
|
| 17 |
# Creating a temporary file to store the uploaded PDF's
|
| 18 |
main_placeholder.text("Data Loading...Started...✅✅✅")
|
| 19 |
for uploaded_file in uploaded_file:
|
|
|
|
| 20 |
# with tempfile.NamedTemporaryFile(delete=False , suffix='.pdf') as temp_file:
|
| 21 |
# temp_file.write(uploaded_file.read()) ## write file to temporary
|
| 22 |
# temp_file_path = temp_file.name # Get the temporary file path
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
|
| 31 |
|
|
|
|
| 17 |
# Creating a temporary file to store the uploaded PDF's
|
| 18 |
main_placeholder.text("Data Loading...Started...✅✅✅")
|
| 19 |
for uploaded_file in uploaded_file:
|
| 20 |
+
|
| 21 |
# with tempfile.NamedTemporaryFile(delete=False , suffix='.pdf') as temp_file:
|
| 22 |
# temp_file.write(uploaded_file.read()) ## write file to temporary
|
| 23 |
# temp_file_path = temp_file.name # Get the temporary file path
|
| 24 |
|
| 25 |
+
temp_file_path = os.path.join("/tmp", uploaded_file.name)
|
| 26 |
+
with open(temp_file_path, "wb") as f:
|
| 27 |
+
f.write(uploaded_file.read())
|
| 28 |
|
| 29 |
+
st.write(f"Uploaded files: {[file.name for file in uploaded_file]}")
|
| 30 |
|
| 31 |
|
| 32 |
|