Arnab Das commited on
Commit
8773f6c
·
1 Parent(s): 1e4d7e8
Files changed (3) hide show
  1. app.py +5 -2
  2. orig_aasist_epoch_1.pth +0 -3
  3. ssl_aasist_epoch_7.pth +0 -3
app.py CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
3
  import models as MOD
4
  import process_data as PD
5
  from transformers import pipeline
 
6
 
7
  model_master = {
8
  "SSL-AASIST (Trained on ASV-Spoof5)": {"eer_threshold": 3.3330237865448,
@@ -18,7 +19,8 @@ model_master = {
18
  }
19
 
20
  model = MOD.Model(None, "cpu")
21
- model.load_state_dict(torch.load("ssl_aasist_epoch_7.pth", map_location="cpu"))
 
22
  model.eval()
23
  loaded_model = "SSL-AASIST (Trained on ASV-Spoof5)"
24
 
@@ -28,7 +30,8 @@ def process(file, type):
28
  inp = getattr(PD, model_master[type]["data_process_func"])(file)
29
  if not loaded_model == type:
30
  model = getattr(MOD, model_master[type]["model_class"])(None, "cpu")
31
- model.load_state_dict(torch.load(model_master[type]["model_checkpoint"], map_location="cpu"))
 
32
  model.eval()
33
  loaded_model = type
34
 
 
3
  import models as MOD
4
  import process_data as PD
5
  from transformers import pipeline
6
+ from huggingface_hub import hf_hub_download
7
 
8
  model_master = {
9
  "SSL-AASIST (Trained on ASV-Spoof5)": {"eer_threshold": 3.3330237865448,
 
19
  }
20
 
21
  model = MOD.Model(None, "cpu")
22
+ base_model_file = hf_hub_download("arnabdas8901/aasist-trained-asvspoof2024", filename="ssl_aasist_epoch_7.pth")
23
+ model.load_state_dict(torch.load(base_model_file, map_location="cpu"))
24
  model.eval()
25
  loaded_model = "SSL-AASIST (Trained on ASV-Spoof5)"
26
 
 
30
  inp = getattr(PD, model_master[type]["data_process_func"])(file)
31
  if not loaded_model == type:
32
  model = getattr(MOD, model_master[type]["model_class"])(None, "cpu")
33
+ model_file = hf_hub_download("arnabdas8901/aasist-trained-asvspoof2024", filename=model_master[type]["model_checkpoint"])
34
+ model.load_state_dict(torch.load(model_file, map_location="cpu"))
35
  model.eval()
36
  loaded_model = type
37
 
orig_aasist_epoch_1.pth DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f26ad87bca3d47e97ecfeac6fee6fcae93f62673a484d447c081d45911e3a027
3
- size 1276136
 
 
 
 
ssl_aasist_epoch_7.pth DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:07e888c07dce17c15c0a299aaacc81ac90f8ad43a9daf9396234baebc44b1944
3
- size 1271618222