-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (27 loc) · 984 Bytes
/
Copy pathmain.cpp
File metadata and controls
36 lines (27 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Batch transcription — multiple files in one forward pass
//
// Usage: example-batch <model.safetensors> <vocab.txt> <audio1.wav> [audio2.wav
// ...]
#include <parakeet/parakeet.hpp>
#include <iostream>
#include <vector>
int main(int argc, char *argv[]) {
if (argc < 4) {
std::cerr << "Usage: " << argv[0]
<< " <model.safetensors> <vocab.txt> <audio1.wav> "
"[audio2.wav ...]\n";
return 1;
}
parakeet::Transcriber t(argv[1], argv[2]);
std::vector<std::string> audio_paths;
for (int i = 3; i < argc; ++i)
audio_paths.push_back(argv[i]);
std::cout << "Transcribing " << audio_paths.size()
<< " file(s) in batch...\n\n";
auto results = t.transcribe_batch(audio_paths);
for (size_t i = 0; i < results.size(); ++i) {
std::cout << "[" << (i + 1) << "] " << audio_paths[i] << "\n"
<< " " << results[i].text << "\n\n";
}
return 0;
}