Metadata-Version: 2.4
Name: transcripy
Version: 1.0.0
Summary: Local transcription of voicebot calls and phone recordings into timed speaker turns.
Author: Bartosz Niewolski
License-Expression: MIT
Project-URL: Homepage, https://github.com/niewolski/TranscriPy
Project-URL: Repository, https://github.com/niewolski/TranscriPy
Project-URL: Issues, https://github.com/niewolski/TranscriPy/issues
Project-URL: Changelog, https://github.com/niewolski/TranscriPy/blob/main/CHANGELOG.md
Keywords: transcription,whisper,faster-whisper,diarization,voicebot,call-center,speech-to-text
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: faster-whisper<2,>=1.2.1
Provides-Extra: diarize
Requires-Dist: pyannote.audio>=3.3; extra == "diarize"
Provides-Extra: server
Requires-Dist: fastapi<1,>=0.104; extra == "server"
Requires-Dist: uvicorn[standard]<1,>=0.24; extra == "server"
Requires-Dist: python-multipart<1,>=0.0.6; extra == "server"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: httpx<0.28,>=0.27; extra == "dev"
Requires-Dist: fastapi<1,>=0.104; extra == "dev"
Requires-Dist: uvicorn[standard]<1,>=0.24; extra == "dev"
Requires-Dist: python-multipart<1,>=0.0.6; extra == "dev"
Dynamic: license-file

# TranscriPy

Local transcription of **voicebot calls and phone recordings** into timed turns with speaker labels. Audio stays on your machine.

```bash
pip install transcripy
```

```python
from transcripy import transcribe

result = transcribe(
    "call.wav",
    language="en",
    speakers=True,
    channel_labels=("agent", "customer"),
    hotwords="TranscriPy, Acme",
    initial_prompt="A voicebot call about the TranscriPy product.",
)

for turn in result.turns():
    print(f"[{turn.speaker}] {turn.text}")
```

```bash
transcripy call.wav \
  --language en \
  --speakers \
  --channel-labels agent,customer \
  --hotwords "TranscriPy, Acme" \
  --prompt "A voicebot call about the TranscriPy product." \
  -o call.json
```

## What it is for

- Stereo call recordings where each party has a channel (agent / customer)
- Mono mixed calls when you install the optional diarization extra
- Offline / self-hosted pipelines that must not upload audio to a cloud ASR API

The public contract is simple: one media file in, a `Transcript` with `segments`, `turns`, and optional per-word timings out. Export as text, SRT, VTT, or JSON.

## Requirements

- Python 3.10+
- [`faster-whisper`](https://github.com/SYSTRAN/faster-whisper) (installed with the package)
- [`ffmpeg`](https://ffmpeg.org/) on `PATH` for video containers and stereo channel split
- Optional NVIDIA CUDA for `--device cuda`
- Optional Hugging Face token for mono speaker diarization (see below)

## Speakers

**Stereo (recommended for voicebots).** `--speakers` (or `speakers=True`) splits the two channels and labels them with `--channel-labels` / `channel_labels`. Default labels are `left` and `right`.

**Mono.** The same flag runs [pyannote](https://github.com/pyannote/pyannote-audio) and assigns each segment the speaker with the largest time overlap. Overlapping speech and similar voices reduce quality; this is not WhisperX-level alignment.

```bash
pip install "transcripy[diarize]"
```

1. Accept the user agreements for [`pyannote/speaker-diarization-3.1`](https://huggingface.co/pyannote/speaker-diarization-3.1) and [`pyannote/segmentation-3.0`](https://huggingface.co/pyannote/segmentation-3.0).
2. Create a Hugging Face access token.
3. Export it as `HF_TOKEN` (or `HUGGING_FACE_HUB_TOKEN`).

## Defaults

| Setting | Default | Notes |
| --- | --- | --- |
| `model` | `large-v3` | Pass a smaller Whisper name (`medium`, `small`, `tiny`) to trade quality for speed |
| `language` | auto-detect | Prefer an ISO code such as `en` or `pl` for call center audio |
| `word_timestamps` | on | Disable with `--no-word-timestamps` / `word_timestamps=False` |
| `device` | `cpu` | Use `cuda` when a GPU is available |

Compared with [WhisperX](https://github.com/m-bain/whisperX): TranscriPy focuses on a small call-recording API and reliable **stereo channel labels**. WhisperX is stronger when you need batched GPU throughput and forced word alignment on mixed mono audio.

## Non-goals (1.0)

- Live / streaming microphone transcription
- Hosted cloud ASR
- Production HTTP API (the `api/` folder in this repo is experimental; not shipped in the wheel)
- High-throughput batched GPU pipelines
- Subtitle tooling for films as the primary use case

## Install options

```bash
pip install transcripy              # library + CLI
pip install "transcripy[diarize]"   # + pyannote for mono speakers
pip install "transcripy[dev]"       # tests and the experimental server deps
```

## Development

```bash
git clone https://github.com/niewolski/TranscriPy.git
cd TranscriPy
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
```

See [CONTRIBUTING.md](CONTRIBUTING.md). Model weight notices are in [NOTICE](NOTICE).
