Yuxiang Wang commited on
Commit
6e2a000
·
1 Parent(s): e01f7c2

debug:model path not found

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. inference_sam.py +2 -1
app.py CHANGED
@@ -31,8 +31,10 @@ if env_name == 'fossil': # in case pkgs installed to unexpected env during local
31
  package_spec = f"{package}=={version}" if version else package
32
  if not is_pkg_installed(package):
33
  #TODO
34
- subprocess.call(f"TMPDIR='../../../tmp/' pip install {package_spec}",shell=True)
35
- #subprocess.call(f"pip install {package_spec}".split())
 
 
36
  else:
37
  print(f"{package_spec} is already installed.")
38
  else:
 
31
  package_spec = f"{package}=={version}" if version else package
32
  if not is_pkg_installed(package):
33
  #TODO
34
+ if package=='torch' or 'torchvision' or 'tensorflow':
35
+ subprocess.call(f"TMPDIR='../../../tmp/' pip install {package_spec}",shell=True)
36
+ else:
37
+ subprocess.call(f"pip install {package_spec}".split())
38
  else:
39
  print(f"{package_spec} is already installed.")
40
  else:
inference_sam.py CHANGED
@@ -30,7 +30,8 @@ if not os.path.exists('model'):
30
  print("warning! A read token in env variables is needed for authentication.")
31
  snapshot_download(repo_id=REPO_ID, token=token,repo_type='model',local_dir='model')
32
 
33
- sam = sam_model_registry["default"]("/model/sam_02-06_dice_mse_0.pth")
 
34
  sam.to(device) #sam.cuda()
35
  predictor = SamPredictor(sam)
36
 
 
30
  print("warning! A read token in env variables is needed for authentication.")
31
  snapshot_download(repo_id=REPO_ID, token=token,repo_type='model',local_dir='model')
32
 
33
+ model_path = os.path.join('model', 'sam_02-06_dice_mse_0.pth')
34
+ sam = sam_model_registry["default"](model_path)
35
  sam.to(device) #sam.cuda()
36
  predictor = SamPredictor(sam)
37