https://github.com/malith-rukshan/whisper-transcriber-bot
๐๏ธ AI-powered Telegram bot for voice-to-text transcription using OpenAI Whisper. CPU-only, no GPU required, privacy-focused with local processing.
https://github.com/malith-rukshan/whisper-transcriber-bot
ai-transcription no-gpu openai-whisper self-hosted speech-recognition speech-to-text whisper-ai whisper-cpp
Last synced: 3 months ago
JSON representation
๐๏ธ AI-powered Telegram bot for voice-to-text transcription using OpenAI Whisper. CPU-only, no GPU required, privacy-focused with local processing.
- Host: GitHub
- URL: https://github.com/malith-rukshan/whisper-transcriber-bot
- Owner: Malith-Rukshan
- License: mit
- Created: 2025-07-10T09:25:59.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-07-10T17:34:25.000Z (3 months ago)
- Last Synced: 2025-07-10T20:18:09.488Z (3 months ago)
- Topics: ai-transcription, no-gpu, openai-whisper, self-hosted, speech-recognition, speech-to-text, whisper-ai, whisper-cpp
- Language: Python
- Homepage: https://t.me/TranscriberXBOT
- Size: 4.36 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
๐๏ธ Whisper Transcriber Bot
[](https://t.me/TranscriberXBOT)
[](https://hub.docker.com/r/malithrukshan/whisper-transcriber-bot)
โจ Transform voice into text instantly with AI-powered transcription magic! โจ
- A self-hosted, privacy-focused transcription for Telegram -
๐ No GPU Required โข No API Keys โข CPU-Only โข Low Resource Usage ใ## โจ Features
- ๐๏ธ **Voice Transcription** - Convert voice messages to text instantly
- ๐ต **Multi-Format Support** - MP3, M4A, WAV, OGG, FLAC audio files
- โก **Concurrent Processing** - Handle multiple users simultaneously
- ๐ **Smart Text Handling** - Auto-generate text files for long transcriptions
- ๐ง **AI-Powered** - OpenAI Whisper model for accurate transcription
- ๐ป **CPU-Only Processing** - No GPU required, runs on basic servers (512MB RAM minimum)
- ๐ซ **No API Dependencies** - No external API keys or cloud services needed
- ๐ณ **Docker Ready** - Easy deployment with containerization
- ๐ **Privacy Focused** - Process audio locally, complete data privacy
- ๐ฐ **Cost Effective** - Ultra-low resource usage, perfect for budget hosting## ๐ฌ Demo
## ๐ One-Click Deploy
[](https://heroku.com/deploy)
[](https://render.com/deploy)[](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Malith-Rukshan/whisper-transcriber-bot/tree/main)
*Deploy instantly to your favorite cloud platform with pre-configured settings! All platforms support CPU-only deployment - no GPU needed!*
## ๐ Quick Start
### Prerequisites
- Docker and Docker Compose
- Telegram Bot Token ([Create Bot](https://t.me/botfather))### Installation
1. **Clone the repository**
```bash
git clone https://github.com/Malith-Rukshan/whisper-transcriber-bot.git
cd whisper-transcriber-bot
```2. **Configure environment**
```bash
cp .env.example .env
nano .env # Add your bot token
```3. **Download AI model**
```bash
chmod +x download_model.sh
./download_model.sh
```4. **Deploy with Docker**
```bash
docker-compose up -d
```๐ **That's it!** Your bot is now running and ready to transcribe audio!
## ๐ Usage
### Bot Commands
| Command | Description |
|---------|-------------|
| `/start` | ๐ Welcome message and bot introduction |
| `/help` | ๐ Detailed usage instructions |
| `/about` | โน๏ธ Bot information and developer details |
| `/status` | ๐ Check bot health and configuration |### How to Use
1. **Send Audio** ๐๏ธ - Forward voice messages or upload audio files
2. **Wait for AI** โณ - Bot processes audio (typically 1-3 seconds)
3. **Get Text** ๐ - Receive transcription or download text file for long content### Supported Formats
- **Voice Messages** - Direct Telegram voice notes
- **Audio Files** - MP3, M4A, WAV, OGG, FLAC (up to 50MB)
- **Document Audio** - Audio files sent as documents## ๐ณ Docker Deployment
### Cloud Deployment (Recommended)
Perfect for cloud platforms like Render, Railway, etc. The model is included in the image.
```yaml
version: '3.8'
services:
whisper-bot:
image: malithrukshan/whisper-transcriber-bot:latest
container_name: whisper-transcriber-bot
restart: unless-stopped
environment:
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
```### Local Development with Volume Mount
For local development where you want to persist models between container rebuilds:
```yaml
version: '3.8'
services:
whisper-bot:
image: malithrukshan/whisper-transcriber-bot:latest
container_name: whisper-transcriber-bot
restart: unless-stopped
environment:
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
volumes:
- ./models:/app/models
```### Using Docker CLI
```bash
# Cloud deployment (model included in image)
docker run -d \
--name whisper-bot \
-e TELEGRAM_BOT_TOKEN=your_token_here \
malithrukshan/whisper-transcriber-bot:latest# Local development (with volume mount)
docker run -d \
--name whisper-bot \
-e TELEGRAM_BOT_TOKEN=your_token_here \
-v $(pwd)/models:/app/models \
malithrukshan/whisper-transcriber-bot:latest
```## ๐ ๏ธ Development
### Local Development Setup
```bash
# Clone and setup
git clone https://github.com/Malith-Rukshan/whisper-transcriber-bot.git
cd whisper-transcriber-bot# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate# Install dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt # Development dependencies# Download model
./download_model.sh# Configure environment
cp .env.example .env
# Add your bot token to .env# Run bot
python src/bot.py
```### Project Structure
```
whisper-transcriber-bot/
โโโ src/ # Source code
โ โโโ bot.py # Main bot application
โ โโโ transcriber.py # Whisper integration
โ โโโ config.py # Configuration management
โ โโโ utils.py # Utility functions
โโโ tests/ # Test files
โ โโโ test_bot.py # Bot functionality tests
โ โโโ test_utils.py # Utility function tests
โโโ .github/workflows/ # CI/CD automation
โโโ models/ # AI model storage
โโโ Dockerfile # Container configuration
โโโ docker-compose.yml # Deployment setup
โโโ requirements.txt # Production dependencies
โโโ requirements-dev.txt # Development dependencies
โโโ README.md # This file
```## ๐งช Testing
### Running Tests
```bash
# Run all tests
python -m pytest# Run with coverage
python -m pytest --cov=src# Run specific test file
python -m pytest tests/test_bot.py# Run with verbose output
python -m pytest -v
```### Test Coverage
The test suite covers:
- โ Bot initialization and configuration
- โ Command handlers (`/start`, `/help`, `/about`, `/status`)
- โ Audio processing workflow
- โ Utility functions
- โ Error handling scenarios### Code Quality
```bash
# Format code
black src/ tests/# Security check
bandit -r src/
```## ๐ง Configuration
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `TELEGRAM_BOT_TOKEN` | Bot token from @BotFather | Required |
| `WHISPER_MODEL_PATH` | Path to Whisper model file | `models/ggml-base.en.bin` |
| `WHISPER_MODEL_NAME` | Model name for display | `base.en` |
| `BOT_USERNAME` | Bot username for branding | `TranscriberXBOT` |
| `MAX_AUDIO_SIZE_MB` | Maximum audio file size | `50` |
| `SUPPORTED_FORMATS` | Supported audio formats | `mp3,m4a,wav,ogg,flac` |
| `LOG_LEVEL` | Logging verbosity | `INFO` |### Performance Tuning
```bash
# Adjust CPU threads for transcription
export WHISPER_THREADS=4# Set memory limits
export WHISPER_MAX_MEMORY=512M# Configure concurrent processing
export MAX_CONCURRENT_TRANSCRIPTIONS=5
```## ๐ Performance Metrics
| Audio Length | Processing Time | Memory Usage |
|--------------|----------------|--------------|
| 30 seconds | ~1.2 seconds | ~180MB |
| 2 minutes | ~2.8 seconds | ~200MB |
| 5 minutes | ~6.1 seconds | ~220MB |### Scaling Recommendations
- **Single Instance**: Handles 50+ concurrent users
- **Minimal Resources**: 1 CPU core, 512MB RAM minimum (no GPU required!)
- **Storage**: 1GB for model + temporary files
- **Cost-Effective**: Perfect for budget VPS hosting ($5-10/month)
- **No External APIs**: Zero ongoing API costs or dependencies
- **Load Balancing**: Deploy multiple instances for higher traffic## ๐ค Contributing
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
### Quick Contribution Steps
1. **Fork** the repository
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
4. **Push** to the branch (`git push origin feature/amazing-feature`)
5. **Open** a Pull Request### Development Guidelines
- Follow PEP 8 style guide
- Write tests for new features
- Update documentation
- Ensure Docker build succeeds
- Run quality checks before PR## ๐ Technical Architecture
### Core Components
- **Framework**: [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) v22.2
- **AI Model**: [OpenAI Whisper](https://github.com/openai/whisper) base.en (147MB, CPU-optimized)
- **Bindings**: [pywhispercpp](https://github.com/aarnphm/pywhispercpp) for C++ performance (no GPU needed)
- **Runtime**: Python 3.11 with asyncio for concurrent processing
- **Container**: Multi-architecture Docker (AMD64/ARM64)
- **Resource**: CPU-only inference, minimal memory footprint### Performance Features
- **Async Processing**: Non-blocking audio transcription
- **Concurrent Handling**: Multiple users supported simultaneously
- **Memory Management**: Efficient model loading and cleanup
- **Error Recovery**: Robust error handling and logging## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- **OpenAI** - For the incredible Whisper speech recognition model
- **pywhispercpp** - High-performance Python bindings for whisper.cpp
- **python-telegram-bot** - Excellent Telegram Bot API framework
- **whisper.cpp** - Optimized C++ implementation of Whisper## ๐จโ๐ป Developer
**Malith Rukshan**
- ๐ Website: [malith.dev](https://malith.dev)
- ๐ง Email: hello@malith.dev
- ๐ฆ Telegram: [@MalithRukshan](https://t.me/MalithRukshan)---
### โญ Star History
[](https://star-history.com/#Malith-Rukshan/whisper-transcriber-bot&Date)
**If this project helped you, please consider giving it a โญ!**
Made with โค๏ธ by [Malith Rukshan](https://malith.dev)
[๐ Try the Bot](https://t.me/TranscriberXBOT) โข [โญ Star on GitHub](https://github.com/Malith-Rukshan/whisper-transcriber-bot) โข [๐ณ Docker Hub](https://hub.docker.com/r/malithrukshan/whisper-transcriber-bot)