Shami96 commited on
Commit
688144c
·
verified ·
1 Parent(s): 876a319

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,6 +3,7 @@ import tempfile
3
  import os
4
  import subprocess
5
  import uuid
 
6
 
7
  def process_files(pdf_file, word_file):
8
  # Each upload returns a path (str) with type="filepath"
@@ -12,8 +13,8 @@ def process_files(pdf_file, word_file):
12
  # Copy user-uploaded files into temp directory with standard names
13
  pdf_path = os.path.join(temp_dir, "input.pdf")
14
  word_path = os.path.join(temp_dir, "input.docx")
15
- os.rename(pdf_file, pdf_path)
16
- os.rename(word_file, word_path)
17
 
18
  # Step 1: Extract PDF data to txt
19
  pdf_txt_path = os.path.join(temp_dir, "pdf_data.txt")
 
3
  import os
4
  import subprocess
5
  import uuid
6
+ import shutil
7
 
8
  def process_files(pdf_file, word_file):
9
  # Each upload returns a path (str) with type="filepath"
 
13
  # Copy user-uploaded files into temp directory with standard names
14
  pdf_path = os.path.join(temp_dir, "input.pdf")
15
  word_path = os.path.join(temp_dir, "input.docx")
16
+ shutil.copy(pdf_file, pdf_path)
17
+ shutil.copy(word_file, word_path)
18
 
19
  # Step 1: Extract PDF data to txt
20
  pdf_txt_path = os.path.join(temp_dir, "pdf_data.txt")