Hamza4100 commited on
Commit
afed50e
·
verified ·
1 Parent(s): 72024a7

Update app/routes/upload.py

Browse files
Files changed (1) hide show
  1. app/routes/upload.py +4 -5
app/routes/upload.py CHANGED
@@ -12,13 +12,12 @@ import uuid
12
  import mimetypes
13
  from datetime import datetime
14
 
15
- router = APIRouter(prefix="/api", tags=["upload"])
16
 
17
- # Absolute path to uploads directory
18
- BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
19
- UPLOAD_FOLDER = os.path.join(BASE_DIR, "uploads")
20
 
21
- # Ensure upload folder exists
 
22
  os.makedirs(UPLOAD_FOLDER, exist_ok=True)
23
 
24
 
 
12
  import mimetypes
13
  from datetime import datetime
14
 
15
+ import tempfile
16
 
17
+ router = APIRouter(prefix="/api", tags=["upload"])
 
 
18
 
19
+ # Portable temp directory for uploads cache (works on Windows, Linux, and HF Spaces Docker)
20
+ UPLOAD_FOLDER = os.getenv("UPLOAD_FOLDER", os.path.join(tempfile.gettempdir(), "aidatrix_uploads"))
21
  os.makedirs(UPLOAD_FOLDER, exist_ok=True)
22
 
23