whisper-smith
whisper-smith is a small Python CLI/app helper for transcribing audio files with OpenAI speech-to-text models.
Features
- Transcribe local audio files
- CLI-first workflow for quick terminal use
- Output as
txt,json,srt, orvtt - Automatically infer output format from output file extension
- Load environment variables from
.env
Run on Google Colab (free GPU)
No local setup needed. Open the notebook directly in Colab and run the full speaker-aligned transcript pipeline on a free T4 GPU:
The notebook covers: install → set API keys → upload audio → run pipeline → download result. Use a GPU runtime for the best diarization performance. The notebook also includes an advanced GPU pipeline for explicitly moving the pyannote model to CUDA.
Requirements
- Python
3.10+ - An OpenAI API key (
OPENAI_API_KEY) - For large-file fallback: either system
ffmpeginPATH, or Python packageimageio-ffmpeg - For optional speaker diarization: a Hugging Face token (
HUGGINGFACE_TOKEN) andpyannote.audio
Installation
Option 1: uv (recommended)
uv sync
Option 2: pip
pip install -e .
Optional speaker diarization dependencies
uv sync --extra diarize
or:
pip install -e ".[diarize]"
Configuration
Set your API key in the environment or in a .env file:
export OPENAI_API_KEY="your_api_key_here"
export HUGGINGFACE_TOKEN="your_huggingface_token_here"
Or create .env in project root:
OPENAI_API_KEY=your_api_key_here
HUGGINGFACE_TOKEN=your_huggingface_token_here
CLI Usage Guide
Basic command:
whisper-smith <audio_path>
Show help:
whisper-smith --help
1) Print transcript to terminal (default txt)
whisper-smith data/sample.m4a
2) Save transcript to a file
whisper-smith data/sample.m4a --output data/sample.txt
3) Choose output format explicitly
whisper-smith data/sample.m4a --format json --output data/sample.json
Supported CLI formats: txt, json, srt, vtt
4) Let format be inferred from output extension
whisper-smith data/sample.m4a --output data/sample.srt
5) Overwrite existing file
whisper-smith data/sample.m4a --output data/sample.txt --overwrite
6) Run speaker diarization
whisper-smith data/sample.m4a --diarize --output data/sample.diarization.json
Diarization currently supports JSON output only. Optional speaker hints:
whisper-smith data/sample.m4a --diarize --format json --num-speakers 2
7) Create speaker-aligned transcript JSON
Run the full pipeline from one audio file:
whisper-smith data/sample.m4a --align --output data/sample.aligned.json
This writes the main aligned transcript JSON to data/sample.aligned.json and
also writes intermediate artifacts beside it:
data/sample.transcript.json
data/sample.diarization.json
To put the intermediate artifacts in a separate directory:
whisper-smith data/sample.m4a --align --output data/sample.aligned.json --artifacts-dir data/artifacts
Python Usage
from pathlib import Path
from whisper_smith.transcribe import transcribe_audio
from whisper_smith.exporters import export_transcript
result = transcribe_audio(Path("data/sample.m4a"))
print(result.text)
srt = export_transcript(result, "srt")
Path("data/sample.srt").write_text(srt, encoding="utf-8")
Speaker diarization
from pathlib import Path
from whisper_smith.diarize import diarize_audio
result = diarize_audio(Path("data/sample.m4a"))
for segment in result.segments:
print(segment.start, segment.end, segment.speaker)
diarize_audio uses HUGGINGFACE_TOKEN from the environment, or accepts
hf_token="..." explicitly.
The default local model is pyannote/speaker-diarization-3.1, which is compatible
with the Intel macOS dependency set. You may pass a different model explicitly
from Python or with --diarization-model when running on a newer platform.
Notes
- If
--outputis omitted, transcript is printed to stdout. - If
--formatis omitted, format is inferred from--outputextension when possible. - If an output file already exists, add
--overwriteto replace it. - Transcription uses a timestamp-capable OpenAI model by default so JSON, SRT, and VTT outputs have segment timestamps.
- For large audio files,
whisper-smithautomatically splits audio into chunks and merges transcript text. - If diarization fails with
torchaudiomissingAudioMetaData, refresh the optional diarization dependencies withuv lock --upgrade-package torch --upgrade-package torchaudioand thenuv sync --extra diarize.
Development
Run tests:
pytest
Metadata
Release files for whisper-smith 0.2.1
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 | |
|---|---|---|---|---|
| whisper_smith-0.2.1.tar.gz | 296.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| whisper_smith-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 312.5 kB
Release files / whisper_smith-0.2.1.tar.gz
| Download URL | whisper_smith-0.2.1.tar.gz |
|---|---|
| Size | 296.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c281ecd8e3411f8e2d82c9b307f4b37708b4069d4aed581223f60e901a9e9b1
|
|
BLAKE2b-256 checksum How to use checksums |
acd13fa7e3038ce2815b11e7465c0c21a9c84dae6e2ec0ea8d4b4b4bf8189739
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / whisper_smith-0.2.1-py3-none-any.whl
| Download URL | whisper_smith-0.2.1-py3-none-any.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f631042da6b936c8edad132352b35e49ffcf0f9864e606b8c267f17a51046a13
|
|
BLAKE2b-256 checksum How to use checksums |
466e6b46d783025fab4e954926494fc5d6281e928e58ee77111f41bde124a33d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for whisper-smith 0.2.1
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.