swayamshetkar commited on
Commit
0257a40
·
verified ·
1 Parent(s): 96f45fe

Update utils/rmbg_model.py

Browse files
Files changed (1) hide show
  1. utils/rmbg_model.py +7 -2
utils/rmbg_model.py CHANGED
@@ -1,10 +1,15 @@
1
  import os
2
 
3
- # ✅ Use a writable path inside Hugging Face Space
4
- CACHE_DIR = "/data/hf_cache" # or "/tmp/hf_cache"
5
  os.environ["HF_HOME"] = CACHE_DIR
6
  os.environ["TRANSFORMERS_CACHE"] = CACHE_DIR
 
 
 
7
  os.makedirs(CACHE_DIR, exist_ok=True)
 
 
8
 
9
 
10
  import torch
 
1
  import os
2
 
3
+ # ✅ Use /tmp/hf_cache (always writable in Hugging Face Spaces)
4
+ CACHE_DIR = "/tmp/hf_cache"
5
  os.environ["HF_HOME"] = CACHE_DIR
6
  os.environ["TRANSFORMERS_CACHE"] = CACHE_DIR
7
+ os.environ["HF_DATASETS_CACHE"] = CACHE_DIR
8
+
9
+ # Create the directory safely
10
  os.makedirs(CACHE_DIR, exist_ok=True)
11
+ print("✅ Using Hugging Face cache directory:", CACHE_DIR)
12
+
13
 
14
 
15
  import torch