Refactor Java API (#806)
This commit is contained in:
@@ -253,7 +253,7 @@ int32_t main(int32_t argc, char *argv[]) {
|
||||
sherpa_onnx::ReadWave(wave_filename, &actual_sample_rate, &is_ok);
|
||||
|
||||
if (!is_ok) {
|
||||
SHERPA_ONNX_LOGE("Failed to read %s", wave_filename.c_str());
|
||||
SHERPA_ONNX_LOGE("Failed to read '%s'", wave_filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ static std::vector<std::vector<float>> ComputeEmbeddings(
|
||||
sherpa_onnx::ReadWave(f, &sampling_rate, &is_ok);
|
||||
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", f.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", f.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ for a list of pre-trained models to download.
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ static std::vector<std::vector<float>> ComputeEmbeddings(
|
||||
sherpa_onnx::ReadWave(f, &sampling_rate, &is_ok);
|
||||
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", f.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", f.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ for more models.
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ for a list of pre-trained models to download.
|
||||
const std::vector<float> samples =
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
float duration = samples.size() / static_cast<float>(sampling_rate);
|
||||
|
||||
@@ -69,7 +69,7 @@ void AsrInference(const std::vector<std::vector<std::string>> &chunk_wav_paths,
|
||||
const std::vector<float> samples =
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
continue;
|
||||
}
|
||||
duration += samples.size() / static_cast<float>(sampling_rate);
|
||||
@@ -96,7 +96,7 @@ void AsrInference(const std::vector<std::vector<std::string>> &chunk_wav_paths,
|
||||
const std::vector<float> samples =
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
continue;
|
||||
}
|
||||
duration += samples.size() / static_cast<float>(sampling_rate);
|
||||
|
||||
@@ -124,7 +124,7 @@ for a list of pre-trained models to download.
|
||||
const std::vector<float> samples =
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
duration += samples.size() / static_cast<float>(sampling_rate);
|
||||
|
||||
@@ -109,7 +109,7 @@ for a list of pre-trained models to download.
|
||||
sherpa_onnx::ReadWave(wav_filename, &sampling_rate, &is_ok);
|
||||
|
||||
if (!is_ok) {
|
||||
fprintf(stderr, "Failed to read %s\n", wav_filename.c_str());
|
||||
fprintf(stderr, "Failed to read '%s'\n", wav_filename.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user