# Copyright (c) Microsoft # 2022 Chengdong Liang (liangchengdong@mail.nwpu.edu.cn) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import gradio as gr import wespeaker # import wespeakerruntime as wespeaker # from sklearn.metrics.pairwise import cosine_similarity STYLE = """ """ OUTPUT_OK = (STYLE + """
WeSpeaker Demo ! Try it with your own voice ! Note: We recommend that the audio length be greater than 5s !
" "CN: cnceleb_resnet34.onnx. EN: voxceleb_resnet34.onnx
") article = ( "") examples = [ ['examples/BAC009S0764W0228.wav', 'examples/BAC009S0764W0328.wav', 'CN'], ['examples/BAC009S0913W0133.wav', 'examples/BAC009S0764W0228.wav', 'CN'], ['examples/00001_spk1.wav', 'examples/00003_spk2.wav', 'EN'], ['examples/00010_spk2.wav', 'examples/00024_spk1.wav', 'EN'], ['examples/00001_spk1.wav', 'examples/00024_spk1.wav', 'EN'], ['examples/00010_spk2.wav', 'examples/00003_spk2.wav', 'EN'], ] interface = gr.Interface( fn=speaker_verification, inputs=inputs, outputs=output, title="Speaker Verification in WeSpeaker : 基于 WeSpeaker 的说话人确认", description=description, article=article, examples=examples, theme="huggingface", ) interface.launch(enable_queue=True)