Team Ai
Apppublic

Xenobd/whisper.cpp

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
README.md53 linesDownload Raw Back to command
1# whisper.cpp/examples/command
2
3This is a basic Voice Assistant example that accepts voice commands from the microphone.
4More info is available in [issue #171](https://github.com/ggerganov/whisper.cpp/issues/171).
5
6```bash
7# Run with default arguments and small model
8./whisper-command -m ./models/ggml-small.en.bin -t 8
9
10# On Raspberry Pi, use tiny or base models + "-ac 768" for better performance
11./whisper-command -m ./models/ggml-tiny.en.bin -ac 768 -t 3 -c 0
12```
13
14https://user-images.githubusercontent.com/1991296/204038393-2f846eae-c255-4099-a76d-5735c25c49da.mp4
15
16Web version: [examples/command.wasm](/examples/command.wasm)
17
18## Guided mode
19
20"Guided mode" allows you to specify a list of commands (i.e. strings) and the transcription will be guided to classify your command into one from the list. This can be useful in situations where a device is listening only for a small subset of commands.
21
22Initial tests show that this approach might be extremely efficient in terms of performance, since it integrates very well with the "partial Encoder" idea from #137.
23
24```bash
25# Run in guided mode, the list of allowed commands is in commands.txt
26./whisper-command -m ./models/ggml-base.en.bin -cmd ./examples/command/commands.txt
27
28# On Raspberry Pi, in guided mode you can use "-ac 128" for extra performance
29./whisper-command -m ./models/ggml-tiny.en.bin -cmd ./examples/command/commands.txt -ac 128 -t 3 -c 0
30```
31
32https://user-images.githubusercontent.com/1991296/207435352-8fc4ed3f-bde5-4555-9b8b-aeeb76bee969.mp4
33
34
35## Building
36
37The `whisper-command` tool depends on SDL2 library to capture audio from the microphone. You can build it like this:
38
39```bash
40# Install SDL2
41# On Debian based linux distributions:
42sudo apt-get install libsdl2-dev
43
44# On Fedora Linux:
45sudo dnf install SDL2 SDL2-devel
46
47# Install SDL2 on Mac OS
48brew install sdl2
49
50cmake -B build -DWHISPER_SDL2=ON
51cmake --build build --config Release
52```
53