Spaces:
Sleeping
Sleeping
Commit
·
0633369
1
Parent(s):
ddeaf8c
ignore temp files
Browse files- .gitignore +1 -4
- src/processing/document_processor.py +8 -2
- temp_files/1.txt +1 -0
.gitignore
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
# Temporary files
|
2 |
-
|
3 |
-
temp_*.pdf
|
4 |
-
temp_*.json
|
5 |
-
temp_*.txt
|
6 |
|
7 |
# Python
|
8 |
__pycache__/
|
|
|
1 |
# Temporary files
|
2 |
+
|
|
|
|
|
|
|
3 |
|
4 |
# Python
|
5 |
__pycache__/
|
src/processing/document_processor.py
CHANGED
@@ -64,9 +64,15 @@ class DocumentProcessor:
|
|
64 |
|
65 |
# Persist outputs to files (JSON and redacted text) for auditing
|
66 |
base_name = os.path.splitext(os.path.basename(file_path))[0]
|
67 |
-
# Use temp directory for output files
|
68 |
temp_dir = "temp_files"
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
json_path = os.path.join(temp_dir, f"{base_name}_structured.json")
|
72 |
redacted_path = os.path.join(temp_dir, f"{base_name}_redacted.txt")
|
|
|
64 |
|
65 |
# Persist outputs to files (JSON and redacted text) for auditing
|
66 |
base_name = os.path.splitext(os.path.basename(file_path))[0]
|
67 |
+
# Use temp directory for output files - try to use the same temp dir as the main app
|
68 |
temp_dir = "temp_files"
|
69 |
+
try:
|
70 |
+
os.makedirs(temp_dir, exist_ok=True)
|
71 |
+
except PermissionError:
|
72 |
+
# Fallback to system temp directory if we can't create in current directory
|
73 |
+
import tempfile
|
74 |
+
temp_dir = os.path.join(tempfile.gettempdir(), "docling_temp_files")
|
75 |
+
os.makedirs(temp_dir, exist_ok=True)
|
76 |
|
77 |
json_path = os.path.join(temp_dir, f"{base_name}_structured.json")
|
78 |
redacted_path = os.path.join(temp_dir, f"{base_name}_redacted.txt")
|
temp_files/1.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
asds
|