Add API to get version information (#2309)
This commit is contained in:
@@ -53,6 +53,7 @@ set(srcs
|
||||
tensorrt-config.cc
|
||||
vad-model-config.cc
|
||||
vad-model.cc
|
||||
version.cc
|
||||
voice-activity-detector.cc
|
||||
wave-writer.cc
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "sherpa-onnx/csrc/offline-source-separation.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "sherpa-onnx/python/csrc/offline-source-separation-model-config.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// sherpa-onnx/python/csrc/offline-source-separation-config.h
|
||||
// sherpa-onnx/python/csrc/offline-source-separation.h
|
||||
//
|
||||
// Copyright (c) 2025 Xiaomi Corporation
|
||||
|
||||
#ifndef SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_CONFIG_H_
|
||||
#define SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_CONFIG_H_
|
||||
#ifndef SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_H_
|
||||
#define SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_H_
|
||||
|
||||
#include "sherpa-onnx/python/csrc/sherpa-onnx.h"
|
||||
|
||||
@@ -13,4 +13,4 @@ void PybindOfflineSourceSeparation(py::module *m);
|
||||
|
||||
}
|
||||
|
||||
#endif // SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_CONFIG_H_
|
||||
#endif // SHERPA_ONNX_PYTHON_CSRC_OFFLINE_SOURCE_SEPARATION_H_
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "sherpa-onnx/python/csrc/spoken-language-identification.h"
|
||||
#include "sherpa-onnx/python/csrc/vad-model-config.h"
|
||||
#include "sherpa-onnx/python/csrc/vad-model.h"
|
||||
#include "sherpa-onnx/python/csrc/version.h"
|
||||
#include "sherpa-onnx/python/csrc/voice-activity-detector.h"
|
||||
#include "sherpa-onnx/python/csrc/wave-writer.h"
|
||||
|
||||
@@ -112,6 +113,7 @@ PYBIND11_MODULE(_sherpa_onnx, m) {
|
||||
PybindAlsa(&m);
|
||||
PybindOfflineSpeechDenoiser(&m);
|
||||
PybindOfflineSourceSeparation(&m);
|
||||
PybindVersion(&m);
|
||||
}
|
||||
|
||||
} // namespace sherpa_onnx
|
||||
|
||||
21
sherpa-onnx/python/csrc/version.cc
Normal file
21
sherpa-onnx/python/csrc/version.cc
Normal file
@@ -0,0 +1,21 @@
|
||||
// sherpa-onnx/python/csrc/version.cc
|
||||
//
|
||||
// Copyright (c) 2025 Xiaomi Corporation
|
||||
|
||||
#include "sherpa-onnx/python/csrc/version.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "sherpa-onnx/csrc/version.h"
|
||||
|
||||
namespace sherpa_onnx {
|
||||
|
||||
void PybindVersion(py::module *m) {
|
||||
m->attr("version") = std::string(GetVersionStr());
|
||||
|
||||
m->attr("git_sha1") = std::string(GetGitSha1());
|
||||
|
||||
m->attr("git_date") = std::string(GetGitDate());
|
||||
}
|
||||
|
||||
} // namespace sherpa_onnx
|
||||
16
sherpa-onnx/python/csrc/version.h
Normal file
16
sherpa-onnx/python/csrc/version.h
Normal file
@@ -0,0 +1,16 @@
|
||||
// sherpa-onnx/python/csrc/version.h
|
||||
//
|
||||
// Copyright (c) 2025 Xiaomi Corporation
|
||||
|
||||
#ifndef SHERPA_ONNX_PYTHON_CSRC_VERSION_H_
|
||||
#define SHERPA_ONNX_PYTHON_CSRC_VERSION_H_
|
||||
|
||||
#include "sherpa-onnx/python/csrc/sherpa-onnx.h"
|
||||
|
||||
namespace sherpa_onnx {
|
||||
|
||||
void PybindVersion(py::module *m);
|
||||
|
||||
}
|
||||
|
||||
#endif // SHERPA_ONNX_PYTHON_CSRC_VERSION_H_
|
||||
Reference in New Issue
Block a user