Uzaiir commited on
Commit
ac7d88d
·
verified ·
1 Parent(s): 8e3e411

Update src/PDFprocess_sample.py

Browse files
Files changed (1) hide show
  1. src/PDFprocess_sample.py +10 -3
src/PDFprocess_sample.py CHANGED
@@ -17,9 +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
  # Load the PDF's from the temporary file path
 
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
+ temp_file_path = os.path.join("/tmp", uploaded_file.name)
25
+ with open(temp_file_path, "wb") as f:
26
+ f.write(uploaded_file.read())
27
+
28
+ st.write(f"Uploaded files: {[file.name for file in uploaded_file]}")
29
+
30
 
31
 
32
  # Load the PDF's from the temporary file path