Spaces:
Runtime error
Runtime error
Commit
·
db8820b
1
Parent(s):
9cb05ac
init upload
Browse files- app.py +31 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import wespeaker
|
| 3 |
+
|
| 4 |
+
model = wespeaker.load_model("vblinkp")
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def speaker_verification(audio_path1, audio_path2):
|
| 8 |
+
if audio_path1 is None or audio_path2 is None:
|
| 9 |
+
gr.warning("Please enter two audios")
|
| 10 |
+
return ""
|
| 11 |
+
|
| 12 |
+
cos_score = model.compute_similarity(audio_path1, audio_path2)
|
| 13 |
+
|
| 14 |
+
return str(cos_score * 100) + "%"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
inputs = [
|
| 18 |
+
gr.Audio(sources="upload", type="filepath", label="Speaker#1"),
|
| 19 |
+
gr.Audio(sources="upload", type="filepath", label="Speaker#2"),
|
| 20 |
+
]
|
| 21 |
+
|
| 22 |
+
output = gr.Textbox(label="")
|
| 23 |
+
|
| 24 |
+
interface = gr.Interface(
|
| 25 |
+
fn=speaker_verification,
|
| 26 |
+
inputs=inputs,
|
| 27 |
+
outputs=output,
|
| 28 |
+
title="Speaker Verification",
|
| 29 |
+
)
|
| 30 |
+
interface.queue(max_size=20)
|
| 31 |
+
interface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
librosa
|
| 2 |
+
git+https://github.com/wenet-e2e/wespeaker.git
|