sneha commited on
Commit
cad7903
1 Parent(s): c54235c

throw error if bin_file not specified

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -54,10 +54,14 @@ def get_model(model_name):
54
  return model #model,embedding_dim,transform,metadata
55
 
56
  def download_bin(model):
 
57
  if model == "vc1-large":
58
  bin_file = 'vc1_vitl.pth'
59
  elif model == "vc1-base":
60
  bin_file = 'vc1_vitb.pth'
 
 
 
61
  bin_path = os.path.join(MODEL_DIR,bin_file)
62
  if not os.path.isfile(bin_path):
63
  model_bin = hf_hub_download(repo_id=REPO_ID, filename='pytorch_model.bin',local_dir=MODEL_DIR,local_dir_use_symlinks=True,token=HF_TOKEN)
 
54
  return model #model,embedding_dim,transform,metadata
55
 
56
  def download_bin(model):
57
+ bin_file = ""
58
  if model == "vc1-large":
59
  bin_file = 'vc1_vitl.pth'
60
  elif model == "vc1-base":
61
  bin_file = 'vc1_vitb.pth'
62
+ else:
63
+ raise NameError("model not found: " + model)
64
+
65
  bin_path = os.path.join(MODEL_DIR,bin_file)
66
  if not os.path.isfile(bin_path):
67
  model_bin = hf_hub_download(repo_id=REPO_ID, filename='pytorch_model.bin',local_dir=MODEL_DIR,local_dir_use_symlinks=True,token=HF_TOKEN)