Transcribes Telegram voice notes and audio files using local Faster-Whisper.
- Python 3.10+
- ffmpeg installed and available in PATH
- Install dependencies:
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt- Create
.env(see.env.example):
cp .env.example .env- Fill in your
TELEGRAM_BOT_TOKEN.
python -m src.mainBuild image:
docker build -t telegram-asr-bot .Run container (replace token):
docker run --rm \
-e TELEGRAM_BOT_TOKEN=123456:ABC \
-e ASR_DEVICE=cpu \
-v $(pwd)/downloads:/app/downloads \
-v $(pwd)/tmp:/app/tmp \
--name telegram-asr-bot \
telegram-asr-botNotes:
- Mounting
downloadsandtmpkeeps files on the host. - For Apple Silicon GPU accel with Faster-Whisper, use
ASR_DEVICE=mps(containerized GPU support varies).
TELEGRAM_BOT_TOKEN(required): Bot token from BotFatherASR_MODEL_SIZE(optional): e.g.base,small,medium,large-v3ASR_DEVICE(optional):auto|cpu|cuda|mpsASR_COMPUTE_TYPE(optional):auto|float16|int8DOWNLOAD_DIR(optional): where Telegram files are savedTMP_DIR(optional): where converted wav files are saved
- Ensure
ffmpegis installed: on macOS viabrew install ffmpeg. - On Apple Silicon, set
ASR_DEVICE=mpsfor Faster-Whisper acceleration.