atwang commited on
Commit
7c581be
1 Parent(s): e5d2d7f

model support from hf

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -19,9 +19,10 @@ NUM_PROCESSES = 1
19
  CROP = False
20
  SCORE_THRESHOLD = 0.8
21
  MAX_PARTS = 5 # TODO: we can replace this by having a slider and a single image visualization component rather than multiple components
 
22
  ARGS = SimpleNamespace(
23
  config_file="configs/coco/instance-segmentation/swin/opd_v1_real.yaml",
24
- model={"repo_id": "3dlg-hcvc/opdmulti-motion-state-rgb-model", "filename": "pytorch_model.pth"},
25
  input_format="RGB",
26
  output=".output",
27
  cpu=True,
@@ -88,8 +89,7 @@ def predict(rgb_image: str, depth_image: str, intrinsic: np.ndarray, num_samples
88
  return [None] * 5
89
 
90
  # run model
91
- weights_path = hf_hub_download(repo_id=ARGS.model["repo_id"], filename=ARGS.model["filename"])
92
- ARGS.model = weights_path
93
  cfg = setup_cfg(ARGS)
94
  engine.launch(
95
  main,
 
19
  CROP = False
20
  SCORE_THRESHOLD = 0.8
21
  MAX_PARTS = 5 # TODO: we can replace this by having a slider and a single image visualization component rather than multiple components
22
+ HF_MODEL_PATH = {"repo_id": "3dlg-hcvc/opdmulti-motion-state-rgb-model", "filename": "pytorch_model.pth"}
23
  ARGS = SimpleNamespace(
24
  config_file="configs/coco/instance-segmentation/swin/opd_v1_real.yaml",
25
+ model=None,
26
  input_format="RGB",
27
  output=".output",
28
  cpu=True,
 
89
  return [None] * 5
90
 
91
  # run model
92
+ ARGS.model = hf_hub_download(repo_id=HF_MODEL_PATH["repo_id"], filename=HF_MODEL_PATH["filename"])
 
93
  cfg = setup_cfg(ARGS)
94
  engine.launch(
95
  main,