Whisper CPP for FastRTC
A PyPI package that wraps Whisper.cpp for speech-to-text (STT) transcription, compatible with the FastRTC STTModel protocol. This package provides efficient, CPU-based speech recognition using the optimized Whisper.cpp implementation.
Installation
pip install fastrtc-whisper-cpp
For audio file loading capabilities, install with the audio extras:
pip install "fastrtc-whisper-cpp[audio]"
For development:
pip install "fastrtc-whisper-cpp[dev]"
Usage
Basic Usage
from fastrtc_whisper_cpp import get_stt_model
import numpy as np
# Create the model (downloads from HF if not cached)
model = get_stt_model()
# Example: Create a sample audio array (actual audio would come from a file or mic)
sample_rate = 16000
audio_data = np.zeros(16000, dtype=np.float32) # 1 second of silence
# Transcribe
text = model.stt((sample_rate, audio_data))
print(f"Transcription: {text}")
Loading Audio Files
If you've installed with the audio extras:
from fastrtc_whisper_cpp import get_stt_model, load_audio
# Load model
model = get_stt_model()
# Load audio file (automatically resamples to 16kHz)
audio = load_audio("path/to/audio.wav")
# Transcribe
text = model.stt(audio)
print(f"Transcription: {text}")
Using with FastRTC
from fastrtc_whisper_cpp import get_stt_model
# Create the model
whisper_model = get_stt_model()
# Use within FastRTC applications
# (Follow FastRTC documentation for integration details)
Available Models
The package supports various Whisper.cpp models with different sizes and quantization levels:
-
English-only models (faster, smaller):
tiny.en,tiny.en-q5_1,tiny.en-q8_0base.en,base.en-q5_1,base.en-q8_0small.en,small.en-q5_1,small.en-q8_0medium.en,medium.en-q5_0,medium.en-q8_0
-
Multilingual models:
tiny,tiny-q5_1,tiny-q8_0base,base-q5_1,base-q8_0small,small-q5_1,small-q8_0medium,medium-q5_0,medium-q8_0large-v1large-v2,large-v2-q5_0,large-v2-q8_0large-v3,large-v3-q5_0large-v3-turbo,large-v3-turbo-q5_0,large-v3-turbo-q8_0
Example:
from fastrtc_whisper_cpp import get_stt_model
# Choose a specific model
model = get_stt_model("medium.en-q8_0")
Advanced Configuration
You can configure the model with specific parameters:
from fastrtc_whisper_cpp import WhisperCppSTT
# Configure with specific model and models directory
model = WhisperCppSTT(
model="medium.en",
models_dir="/path/to/models" # Optional custom models directory
)
Requirements
- Python 3.10+
- numpy
- pywhispercpp
- librosa (optional, for audio file loading)
- click (for CLI features)
Development
Clone the repository and install in development mode:
git clone https://github.com/mahimairaja/fastrtc-whisper-cpp.git
cd fastrtc-whisper-cpp
pip install -e ".[dev,audio]"
License
MIT
Metadata
Release files for fastrtc-whisper-cpp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastrtc_whisper_cpp-0.1.2.tar.gz | 830.1 kB | Without provenance | Details for fastrtc_whisper_cpp-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastrtc_whisper_cpp-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for fastrtc_whisper_cpp-0.1.2-py3-none-any.whl |
Total release size: 1.6 MB
Release files / fastrtc_whisper_cpp-0.1.2.tar.gz
| Download URL | fastrtc_whisper_cpp-0.1.2.tar.gz |
|---|---|
| Size | 830.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcab785c86de51ad8862615f1931c18262a05f86f6215f6eaedfde6a9245e4b8
|
|
BLAKE2b-256 checksum How to use checksums |
1ac3bd634b31112ce501229055e99e945ac421a0b461b0a6bec4437fa08c03c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.27
|
Release files / fastrtc_whisper_cpp-0.1.2-py3-none-any.whl
| Download URL | fastrtc_whisper_cpp-0.1.2-py3-none-any.whl |
|---|---|
| Size | 773.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebc4856dacde9cfa3ad2c66348b960236854ac9af2b62e847c13557df65b143c
|
|
BLAKE2b-256 checksum How to use checksums |
ba6f5d6d36730838b2458b2f4660c23aba08cdbb05cfd4cc5b74fcebc92d835a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.27
|
Security for fastrtc-whisper-cpp 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.