Krokodilpirat commited on
Commit
a806278
·
verified ·
1 Parent(s): eb0243d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -50,11 +50,19 @@ model_name = encoder2name[encoder]
50
 
51
  # Initialize the model.
52
  video_depth_anything = VideoDepthAnything(**model_configs[encoder])
 
 
 
 
 
 
53
  filepath = hf_hub_download(
54
  repo_id=f"depth-anything/Video-Depth-Anything-{model_name}",
55
  filename=f"video_depth_anything_{encoder}.pth",
56
- repo_type="model"
 
57
  )
 
58
  video_depth_anything.load_state_dict(torch.load(filepath, map_location='cpu'))
59
  video_depth_anything = video_depth_anything.to(DEVICE).eval()
60
 
 
50
 
51
  # Initialize the model.
52
  video_depth_anything = VideoDepthAnything(**model_configs[encoder])
53
+
54
+ # Set cache directories to writable locations
55
+ os.environ["HF_HOME"] = "/tmp/huggingface"
56
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
57
+ os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
58
+
59
  filepath = hf_hub_download(
60
  repo_id=f"depth-anything/Video-Depth-Anything-{model_name}",
61
  filename=f"video_depth_anything_{encoder}.pth",
62
+ repo_type="model",
63
+ cache_dir="/tmp/huggingface" # Explizites Setzen des Cache-Verzeichnisses
64
  )
65
+
66
  video_depth_anything.load_state_dict(torch.load(filepath, map_location='cpu'))
67
  video_depth_anything = video_depth_anything.to(DEVICE).eval()
68