SammyLim commited on
Commit
a52ec28
·
verified ·
1 Parent(s): 168e955

Clear error when HF_TOKEN secret is missing

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -45,6 +45,10 @@ GREEN = np.array([120, 255, 155], np.float32)
45
  # ---------------------------------------------------------------- models
46
  print("[startup] downloading VideoMaMa++ (private repo)...", flush=True)
47
  _local = os.environ.get("VIDEOMAMAPP_LOCAL_DIR") # local testing only
 
 
 
 
48
  _private = Path(_local) if _local else Path(snapshot_download(PRIVATE_REPO, token=HF_TOKEN))
49
  sys.path.insert(0, str(_private / "code"))
50
  import videomamapp_inference as vmpp # noqa: E402
 
45
  # ---------------------------------------------------------------- models
46
  print("[startup] downloading VideoMaMa++ (private repo)...", flush=True)
47
  _local = os.environ.get("VIDEOMAMAPP_LOCAL_DIR") # local testing only
48
+ if not _local and not HF_TOKEN:
49
+ raise RuntimeError(
50
+ "HF_TOKEN is not set. Add a read token with access to the private model repo "
51
+ f"{PRIVATE_REPO} and to facebook/sam3 as a Space secret named HF_TOKEN.")
52
  _private = Path(_local) if _local else Path(snapshot_download(PRIVATE_REPO, token=HF_TOKEN))
53
  sys.path.insert(0, str(_private / "code"))
54
  import videomamapp_inference as vmpp # noqa: E402