Spaces:
Sleeping
Sleeping
Irsh Vijayvargia
commited on
Commit
·
1071dae
1
Parent(s):
621e680
Add application file
Browse files
app.py
CHANGED
@@ -89,18 +89,15 @@ def get_embedding(data, embedder_net, device, n_threshold=-1):
|
|
89 |
|
90 |
model_path = "./speech_id_checkpoint/saved_02.model"
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
embedder_net = SpeechEmbedder().to(device)
|
96 |
-
embedder_net.load_state_dict(torch.load(model_path, map_location=device))
|
97 |
embedder_net.eval()
|
98 |
|
99 |
def process_audio(audio1, audio2, threshold):
|
100 |
-
e1 = get_embedding(audio1, embedder_net, device)
|
101 |
if(e1 is None):
|
102 |
return "No Voice Detected in file 1"
|
103 |
-
e2 = get_embedding(audio2, embedder_net, device)
|
104 |
if(e2 is None):
|
105 |
return "No Voice Detected in file 2"
|
106 |
|
|
|
89 |
|
90 |
model_path = "./speech_id_checkpoint/saved_02.model"
|
91 |
|
92 |
+
embedder_net = SpeechEmbedder()
|
93 |
+
embedder_net.load_state_dict(torch.load(model_path))
|
|
|
|
|
|
|
94 |
embedder_net.eval()
|
95 |
|
96 |
def process_audio(audio1, audio2, threshold):
|
97 |
+
e1 = get_embedding(audio1, embedder_net, torch.device("cpu"))
|
98 |
if(e1 is None):
|
99 |
return "No Voice Detected in file 1"
|
100 |
+
e2 = get_embedding(audio2, embedder_net, torch.device("cpu"))
|
101 |
if(e2 is None):
|
102 |
return "No Voice Detected in file 2"
|
103 |
|