Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
| 16 |
-
|
| 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")
|