Spaces:
Build error
Build error
Update src/components/faceswap.py
Browse files
src/components/faceswap.py
CHANGED
|
@@ -33,10 +33,10 @@ class FaceSwapper:
|
|
| 33 |
# Set up the gdown cache directory
|
| 34 |
gdown_cache_dir = "/tmp/.cache/gdown"
|
| 35 |
os.makedirs(gdown_cache_dir, exist_ok=True)
|
| 36 |
-
os.environ['XDG_CACHE_HOME'] =
|
| 37 |
|
| 38 |
# Log the cache directory and cookie path for debugging
|
| 39 |
-
logger.info(f"Setting XDG_CACHE_HOME to: {
|
| 40 |
|
| 41 |
# Ensure cookies.txt exists
|
| 42 |
cookie_path = os.path.join(gdown_cache_dir, "cookies.txt")
|
|
@@ -46,6 +46,9 @@ class FaceSwapper:
|
|
| 46 |
pass
|
| 47 |
logger.info(f"Ensured cookies.txt exists at: {cookie_path}")
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
# Check if model path exists, and download if not
|
| 50 |
if not os.path.exists(model_path):
|
| 51 |
os.makedirs(os.path.dirname(model_path), exist_ok=True)
|
|
|
|
| 33 |
# Set up the gdown cache directory
|
| 34 |
gdown_cache_dir = "/tmp/.cache/gdown"
|
| 35 |
os.makedirs(gdown_cache_dir, exist_ok=True)
|
| 36 |
+
os.environ['XDG_CACHE_HOME'] = "/tmp/.cache"
|
| 37 |
|
| 38 |
# Log the cache directory and cookie path for debugging
|
| 39 |
+
logger.info(f"Setting XDG_CACHE_HOME to: {os.environ['XDG_CACHE_HOME']}")
|
| 40 |
|
| 41 |
# Ensure cookies.txt exists
|
| 42 |
cookie_path = os.path.join(gdown_cache_dir, "cookies.txt")
|
|
|
|
| 46 |
pass
|
| 47 |
logger.info(f"Ensured cookies.txt exists at: {cookie_path}")
|
| 48 |
|
| 49 |
+
# Set gdown's home directory explicitly
|
| 50 |
+
gdown.config.home = gdown_cache_dir
|
| 51 |
+
|
| 52 |
# Check if model path exists, and download if not
|
| 53 |
if not os.path.exists(model_path):
|
| 54 |
os.makedirs(os.path.dirname(model_path), exist_ok=True)
|