Spaces:
Sleeping
Sleeping
Amamrnaf
commited on
Commit
·
50c7387
1
Parent(s):
6e805b9
`Added import of shutil and modified file saving logic in app.py`
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from PIL import Image
|
|
| 4 |
import os
|
| 5 |
from functions import get_image_informations
|
| 6 |
from dataSchema import *
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
|
|
@@ -150,11 +151,11 @@ def process_pdf(file, option):
|
|
| 150 |
|
| 151 |
save_dir = "uploaded_files"
|
| 152 |
os.makedirs(save_dir, exist_ok=True) # Create the directory if it doesn't exist
|
|
|
|
| 153 |
|
| 154 |
-
# Save the uploaded file
|
| 155 |
file_path = os.path.join(save_dir, file.name)
|
| 156 |
-
|
| 157 |
-
f.write(file.read())
|
| 158 |
|
| 159 |
# Process based on the selected option
|
| 160 |
if option == "Noc_timesheet_resdiential":
|
|
|
|
| 4 |
import os
|
| 5 |
from functions import get_image_informations
|
| 6 |
from dataSchema import *
|
| 7 |
+
import shutil
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
| 151 |
|
| 152 |
save_dir = "uploaded_files"
|
| 153 |
os.makedirs(save_dir, exist_ok=True) # Create the directory if it doesn't exist
|
| 154 |
+
|
| 155 |
|
| 156 |
+
# Save the uploaded file to the new location
|
| 157 |
file_path = os.path.join(save_dir, file.name)
|
| 158 |
+
shutil.copy(file.name, file_path)
|
|
|
|
| 159 |
|
| 160 |
# Process based on the selected option
|
| 161 |
if option == "Noc_timesheet_resdiential":
|