A simple Python wrapper for whisper.cpp
Project description
Simpler Whisper
A zero-dependency simple Python wrapper for whisper.cpp, providing an easy-to-use interface for speech recognition using the Whisper model.
Why is it better than faster-whisper and pywhispercpp:
- Zero-dependency: Everything is shipped with the built wheel, no Python dependency (on
avorctranslate2etc.) except fornumpy. - Dead simple API: call
.transcribe()and get a result - Acceleration enabled: supports whatever whisper.cpp supports
- Updated: using precompiled whisper.cpp from https://github.com/locaal-ai/occ-ai-dep-whispercpp
- Build time: builds in 2 minutes because it's using a precompiled binary
Installation
To install simpler-whisper, you need:
- A C++ compiler (e.g., GCC, Clang, or MSVC)
- CMake (version 3.12 or higher)
- NumPy
Then you can install using pip:
pip install simpler-whisper
Usage
import simpler_whisper.whisper
import numpy as np
# Load the model file.
# It's on you to download one from https://huggingface.co/ggerganov/whisper.cpp
model = simpler_whisper.whisper.load_model("path/to/model.bin")
# Load your 16kHz mono audio samples as a numpy array of float32
# It's on you if you need to convert (use av) or resample (use resampy)
audio = np.frombuffer(open("path/to/audio.raw", "rb").read(), dtype=np.float32)
# Transcribe
transcription = model.transcribe(audio)
print(transcription)
Platform-specific notes
- On Windows, the package uses a DLL (whisper.dll), which is included in the package.
- On Mac and Linux, the package uses static libraries that are linked into the extension.
Building from source
If you're building from source:
- Clone the repository:
git clone https://github.com/locaal-ai/simpler-whisper.git cd simpler-whisper - Install the package in editable mode:
pip install -e .
This will run the CMake build process and compile the extension.
Build Configuration
Simpler Whisper supports various build configurations to optimize for different hardware and acceleration methods. You can specify the build configuration using environment variables:
SIMPLER_WHISPER_ACCELERATION: Specifies the acceleration method. Options are:cpu(default)cuda(for NVIDIA GPUs)hipblas(for AMD GPUs)vulkan(for cross-platform GPU acceleration)
Example: Building for Windows with CUDA acceleration
$env:SIMPLER_WHISPER_ACCELERATION="cuda"
pip install .
Example: Building for macOS ARM64
pip install .
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simpler_whisper-0.2.4.post1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
039898ecfa5ce6ebffcbf829080b551c7634d5f9169fffd984b59c98d546c7be
|
|
| MD5 |
82d04ef56980b34cc0c35b553bf56343
|
|
| BLAKE2b-256 |
0d83a94be9f6b4ebde0bfe52acc9813c00a0278c5a194d784394a7b61aea2bd4
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac8bb636c2985d8e5e8b330cafdd56c80065c996d9f02480e3484efae71ba37d
|
|
| MD5 |
80664c41c8faa3b1f3b99a8e75029b6d
|
|
| BLAKE2b-256 |
35668560ba1ca3380b6b6a3f3809175b07b916db36e843b063071f064c996786
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp312-cp312-macosx_10_13_universal2.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b9b78cc885879ecc3b521f94596704154840612b5e15b884dd82a8a4b8811aa
|
|
| MD5 |
aba40db2c91a36a23ab49016eaa6a0de
|
|
| BLAKE2b-256 |
c51bfba333f3271775a0501f279f79aa8bb2d88bcc3f3086f5d85ed25416c4bc
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a820560eef729c08f983ac468fdd9d458e02c6942a20c767adc2581a4f54ed38
|
|
| MD5 |
fd4f3f328496d859423917ad0a65e745
|
|
| BLAKE2b-256 |
3358b0ae5451a32080be231b590972ed01fee6ab166beceba33628437639c17a
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddc8b16f3fa5e3a843724a405049600e6aa2757831095becda09d17b2f89b95c
|
|
| MD5 |
b1738ee382670b5f5a282646c064392f
|
|
| BLAKE2b-256 |
eda83ca26f99e85658c64e4957de9315ba42c8cd85f5eb35db7939dbb48e55b3
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp311-cp311-macosx_10_13_universal2.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp311-cp311-macosx_10_13_universal2.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d8d193122ad17b38f719bc9b4124ebdbe23e0cca681f977c06fcd271558607f
|
|
| MD5 |
883b1c8228b2a139df12c37267a9855b
|
|
| BLAKE2b-256 |
b308f994a07c1951015fae8f8cf89cc46824c36657d568b404807c59054657f1
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 13.2 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b42cc736cc993f014e190f193b384701ec7f3bc6a7bed3993eedcd3edaeede3f
|
|
| MD5 |
fde9f0061ba458a1e6dc7de0f001ebdd
|
|
| BLAKE2b-256 |
afe6d14a68b3a9edc544a6fe5f49a89c304169cac74ed8c6fbc81fef1b4e22d5
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 734.4 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85eaa44814e60e8ff6b838408c6fdb1a95e5ec71c5e2e5ccc9fff8f7b798a23a
|
|
| MD5 |
17c10c554298f8a59420dca081a3b270
|
|
| BLAKE2b-256 |
141706e0316b85ebe1a31a27495960cb77999614510eafbc7b81ee81616dbc3c
|
File details
Details for the file simpler_whisper-0.2.4.post1-cp310-cp310-macosx_10_13_universal2.whl.
File metadata
- Download URL: simpler_whisper-0.2.4.post1-cp310-cp310-macosx_10_13_universal2.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18c22454bb009f364979f2d893de8203b7513033b3f90eea6ff2c26d6481d4c2
|
|
| MD5 |
822810de74e9f3a6a2da4e3601d69df4
|
|
| BLAKE2b-256 |
57ef5ac6098bf97f1b1f7ec83faa736779170fa00f9bde07302bcad22217efce
|