vettorazi commited on
Commit
e5b90cb
1 Parent(s): 7709e9c

trying to fix for multiple models

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -62,12 +62,24 @@ else:
62
  cluster_model_path = None
63
  default_cluster_infer_ratio = default_cluster_infer_ratio if cluster_model_path else 0
64
 
65
- generator_path = hf_hub_download(repo_id, ckpt_name)
 
 
 
 
 
 
 
 
 
 
 
 
66
  config_path = hf_hub_download(repo_id, "config.json")
67
  hparams = HParams(**json.loads(Path(config_path).read_text()))
68
  speakers = list(hparams.spk.keys())
69
  device = "cuda" if torch.cuda.is_available() else "cpu"
70
- model = Svc(net_g_path=generator_path, config_path=config_path, device=device, cluster_model_path=cluster_model_path)
71
  demucs_model = get_model(DEFAULT_MODEL)
72
 
73
 
 
62
  cluster_model_path = None
63
  default_cluster_infer_ratio = default_cluster_infer_ratio if cluster_model_path else 0
64
 
65
+ #generator_path = hf_hub_download(repo_id, ckpt_name)
66
+ generator_path = None
67
+ if speaker == speakers[0]:
68
+ generator_path = hf_hub_download(repo_id, "G_10000.pth")
69
+ elif speaker == speakers[1]:
70
+ generator_path = hf_hub_download(repo_id, "G_534.pth")
71
+ elif speaker == speakers[2]:
72
+ generator_path = hf_hub_download(repo_id, "G_9933.pth")
73
+ else:
74
+ # Handle the case when the speaker type is not recognized
75
+ raise ValueError("Invalid speaker type")
76
+
77
+ model = Svc(net_g_path=generator_path, config_path=config_path, device=device, cluster_model_path=cluster_model_path)
78
  config_path = hf_hub_download(repo_id, "config.json")
79
  hparams = HParams(**json.loads(Path(config_path).read_text()))
80
  speakers = list(hparams.spk.keys())
81
  device = "cuda" if torch.cuda.is_available() else "cpu"
82
+ #model = Svc(net_g_path=generator_path, config_path=config_path, device=device, cluster_model_path=cluster_model_path)
83
  demucs_model = get_model(DEFAULT_MODEL)
84
 
85