Spaces:
Running
Running
Liangcd
commited on
Commit
·
bf69686
1
Parent(s):
1172100
[demo] update cosine score
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ OUTPUT_OK = (STYLE + """
|
|
29 |
<div class="row"><h1 class="display-1 text-success" style="text-align: center">{:.1f}%</h1></div>
|
30 |
<div class="row"><h1 style="text-align: center">similar</h1></div>
|
31 |
<div class="row"><h1 class="text-success" style="text-align: center">Welcome, human!</h1></div>
|
32 |
-
<div class="row"><small style="text-align: center">(You must get at least
|
33 |
</div>
|
34 |
""")
|
35 |
OUTPUT_FAIL = (STYLE + """
|
@@ -38,7 +38,7 @@ OUTPUT_FAIL = (STYLE + """
|
|
38 |
<div class="row"><h1 class="display-1 text-danger" style="text-align: center">{:.1f}%</h1></div>
|
39 |
<div class="row"><h1 style="text-align: center">similar</h1></div>
|
40 |
<div class="row"><h1 class="text-danger" style="text-align: center">Warning! stranger!</h1></div>
|
41 |
-
<div class="row"><small style="text-align: center">(You must get at least
|
42 |
</div>
|
43 |
""")
|
44 |
|
@@ -112,7 +112,7 @@ def speaker_verification(audio_path1, audio_path2, lang='CN'):
|
|
112 |
-1))[0][0]
|
113 |
cos_score = (cos_score + 1) / 2.0
|
114 |
|
115 |
-
if cos_score >= 0.
|
116 |
output = OUTPUT_OK.format(cos_score * 100)
|
117 |
else:
|
118 |
output = OUTPUT_FAIL.format(cos_score * 100)
|
|
|
29 |
<div class="row"><h1 class="display-1 text-success" style="text-align: center">{:.1f}%</h1></div>
|
30 |
<div class="row"><h1 style="text-align: center">similar</h1></div>
|
31 |
<div class="row"><h1 class="text-success" style="text-align: center">Welcome, human!</h1></div>
|
32 |
+
<div class="row"><small style="text-align: center">(You must get at least 73% to be considered the same person)</small><div class="row">
|
33 |
</div>
|
34 |
""")
|
35 |
OUTPUT_FAIL = (STYLE + """
|
|
|
38 |
<div class="row"><h1 class="display-1 text-danger" style="text-align: center">{:.1f}%</h1></div>
|
39 |
<div class="row"><h1 style="text-align: center">similar</h1></div>
|
40 |
<div class="row"><h1 class="text-danger" style="text-align: center">Warning! stranger!</h1></div>
|
41 |
+
<div class="row"><small style="text-align: center">(You must get at least 73% to be considered the same person)</small><div class="row">
|
42 |
</div>
|
43 |
""")
|
44 |
|
|
|
112 |
-1))[0][0]
|
113 |
cos_score = (cos_score + 1) / 2.0
|
114 |
|
115 |
+
if cos_score >= 0.73:
|
116 |
output = OUTPUT_OK.format(cos_score * 100)
|
117 |
else:
|
118 |
output = OUTPUT_FAIL.format(cos_score * 100)
|