roll-ai commited on
Commit
4da8dee
Β·
verified Β·
1 Parent(s): 7b58632

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -17
app.py CHANGED
@@ -11,28 +11,25 @@ import traceback
11
  # =========================================
12
  # 1. Define Hugging Face weights and paths
13
  # =========================================
 
14
 
15
- HF_DATASET_URL = "https://huggingface.co/datasets/roll-ai/FloVD-weights/resolve/main/ckpt"
16
- WEIGHT_FILES = {
17
- "FVSM/FloVD_FVSM_Controlnet.pt": "FVSM/FloVD_FVSM_Controlnet.pt",
18
- "OMSM/selected_blocks.safetensors": "OMSM/selected_blocks.safetensors",
19
- "OMSM/pytorch_lora_weights.safetensors": "OMSM/pytorch_lora_weights.safetensors",
20
- "others/depth_anything_v2_metric_hypersim_vitb.pth": "others/depth_anything_v2_metric_hypersim_vitb.pth"
21
- }
22
 
23
  def download_weights():
24
- print("πŸ”„ Downloading model weights...")
25
  for rel_path in WEIGHT_FILES.values():
26
- save_path = Path("ckpt") / rel_path
27
- if not save_path.exists():
28
- save_path.parent.mkdir(parents=True, exist_ok=True)
29
- url = f"{HF_DATASET_URL}/{rel_path}"
30
- print(f"πŸ“₯ Downloading {url} β†’ {save_path}")
31
- subprocess.run(["wget", "-q", "-O", str(save_path), url], check=True)
 
 
 
 
32
  else:
33
- print(f"βœ… Already exists: {save_path}")
34
-
35
- download_weights()
36
 
37
  from inference.flovd_demo import generate_video
38
 
 
11
  # =========================================
12
  # 1. Define Hugging Face weights and paths
13
  # =========================================
14
+ from huggingface_hub import hf_hub_download
15
 
16
+ HF_DATASET_REPO = "roll-ai/FloVD-weights" # dataset repo ID
 
 
 
 
 
 
17
 
18
  def download_weights():
19
+ print("πŸ”„ Downloading model weights via huggingface_hub...")
20
  for rel_path in WEIGHT_FILES.values():
21
+ local_path = Path("ckpt") / rel_path
22
+ if not local_path.exists():
23
+ print(f"πŸ“₯ Downloading {rel_path}")
24
+ hf_hub_download(
25
+ repo_id=HF_DATASET_REPO,
26
+ repo_type="dataset",
27
+ filename=rel_path,
28
+ local_dir="ckpt",
29
+ local_dir_use_symlinks=False,
30
+ )
31
  else:
32
+ print(f"βœ… Already exists: {local_path}")
 
 
33
 
34
  from inference.flovd_demo import generate_video
35