Add Android demo for speaker recognition (#536)

See pre-built Android APKs at 
https://k2-fsa.github.io/sherpa/onnx/speaker-identification/apk.html
This commit is contained in:
Fangjun Kuang
2024-01-23 16:50:52 +08:00
committed by GitHub
parent 626775e5e2
commit bbd7c7fc18
73 changed files with 3022 additions and 6 deletions

View File

@@ -17,6 +17,14 @@ void PybindSpeakerEmbeddingManager(py::module *m) {
.def(py::init<int32_t>(), py::arg("dim"),
py::call_guard<py::gil_scoped_release>())
.def_property_readonly("num_speakers", &PyClass::NumSpeakers)
.def_property_readonly("dim", &PyClass::Dim)
.def_property_readonly("all_speakers", &PyClass::GetAllSpeakers)
.def(
"__contains__",
[](const PyClass &self, const std::string &name) -> bool {
return self.Contains(name);
},
py::arg("name"), py::call_guard<py::gil_scoped_release>())
.def(
"add",
[](const PyClass &self, const std::string &name,
@@ -25,6 +33,14 @@ void PybindSpeakerEmbeddingManager(py::module *m) {
},
py::arg("name"), py::arg("v"),
py::call_guard<py::gil_scoped_release>())
.def(
"add",
[](const PyClass &self, const std::string &name,
const std::vector<std::vector<float>> &embedding_list) -> bool {
return self.Add(name, embedding_list);
},
py::arg("name"), py::arg("embedding_list"),
py::call_guard<py::gil_scoped_release>())
.def(
"remove",
[](const PyClass &self, const std::string &name) -> bool {