nithinraok
commited on
Commit
•
c2ea8b8
1
Parent(s):
c762f30
Add file upload feature
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ OUTPUT_FAIL = (
|
|
32 |
"""
|
33 |
)
|
34 |
|
35 |
-
THRESHOLD = 0.
|
36 |
|
37 |
model_name = "nvidia/speakerverification_en_titanet_large"
|
38 |
model = EncDecSpeakerLabelModel.from_pretrained(model_name).to(device)
|
@@ -64,8 +64,11 @@ inputs = [
|
|
64 |
gr.inputs.Audio(source="microphone", type="filepath", optional=True, label="Speaker #1"),
|
65 |
gr.inputs.Audio(source="microphone", type="filepath", optional=True, label="Speaker #2"),
|
66 |
]
|
67 |
-
output = gr.outputs.HTML(label="")
|
68 |
|
|
|
|
|
|
|
|
|
69 |
|
70 |
description = (
|
71 |
"This demonstration will analyze two recordings of speech and ascertain whether they have been spoken by the same individual.\n"
|
@@ -85,10 +88,24 @@ examples = [
|
|
85 |
["data/id10270_5r0dWxy17C8-00002.wav", "data/id10271_1gtz-CUIygI-00002.wav"],
|
86 |
]
|
87 |
|
88 |
-
|
89 |
fn=compare_samples,
|
90 |
inputs=inputs,
|
91 |
-
outputs=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
title="Speaker Verification with TitaNet Embeddings",
|
93 |
description=description,
|
94 |
article=article,
|
@@ -98,4 +115,7 @@ interface = gr.Interface(
|
|
98 |
live=False,
|
99 |
examples=examples,
|
100 |
)
|
101 |
-
|
|
|
|
|
|
|
|
32 |
"""
|
33 |
)
|
34 |
|
35 |
+
THRESHOLD = 0.80
|
36 |
|
37 |
model_name = "nvidia/speakerverification_en_titanet_large"
|
38 |
model = EncDecSpeakerLabelModel.from_pretrained(model_name).to(device)
|
|
|
64 |
gr.inputs.Audio(source="microphone", type="filepath", optional=True, label="Speaker #1"),
|
65 |
gr.inputs.Audio(source="microphone", type="filepath", optional=True, label="Speaker #2"),
|
66 |
]
|
|
|
67 |
|
68 |
+
upload_inputs = [
|
69 |
+
gr.inputs.Audio(source="upload", type="filepath", optional=True, label="Speaker #1"),
|
70 |
+
gr.inputs.Audio(source="upload", type="filepath", optional=True, label="Speaker #2"),
|
71 |
+
]
|
72 |
|
73 |
description = (
|
74 |
"This demonstration will analyze two recordings of speech and ascertain whether they have been spoken by the same individual.\n"
|
|
|
88 |
["data/id10270_5r0dWxy17C8-00002.wav", "data/id10271_1gtz-CUIygI-00002.wav"],
|
89 |
]
|
90 |
|
91 |
+
microphone_interface = gr.Interface(
|
92 |
fn=compare_samples,
|
93 |
inputs=inputs,
|
94 |
+
outputs=gr.outputs.HTML(label=""),
|
95 |
+
title="Speaker Verification with TitaNet Embeddings",
|
96 |
+
description=description,
|
97 |
+
article=article,
|
98 |
+
layout="horizontal",
|
99 |
+
theme="huggingface",
|
100 |
+
allow_flagging=False,
|
101 |
+
live=False,
|
102 |
+
examples=examples,
|
103 |
+
)
|
104 |
+
|
105 |
+
upload_interface = gr.Interface(
|
106 |
+
fn=compare_samples,
|
107 |
+
inputs=upload_inputs,
|
108 |
+
outputs=gr.outputs.HTML(label=""),
|
109 |
title="Speaker Verification with TitaNet Embeddings",
|
110 |
description=description,
|
111 |
article=article,
|
|
|
115 |
live=False,
|
116 |
examples=examples,
|
117 |
)
|
118 |
+
|
119 |
+
demo = gr.TabbedInterface([microphone_interface, upload_interface], ["Microphone", "Upload File"])
|
120 |
+
|
121 |
+
demo.launch(enable_queue=True)
|