Echo is a lightweight, asynchronous API service designed for fast and efficient audio transcription. Built on top of Starlette and Faster Whisper, it provides a simple interface to transcribe audio files into text with high accuracy.
- Fast Transcription: Utilizes CTranslate2-powered Whisper models for up to 4x faster inference than original OpenAI Whisper.
- Async API: Built with Starlette for high-performance, asynchronous request handling.
- Configurable: Easily switch model sizes (
tiny,base,small,medium,large-v2, etc.) and compute types via environment variables. - Docker Ready: Includes a Dockerfile for easy containerization and deployment.
- Detailed Output: Returns full transcripts along with segment-level timestamps and language detection probabilities.
- Python 3.11+
- uv (recommended) or pip
-
Clone the repository:
git clone https://github.com/benpoppy/echo.git cd echo
-
Install dependencies:
uv sync # OR using pip pip install .
Start the server using Uvicorn:
uvicorn main:app --host 0.0.0.0 --port 8000The server will start at http://localhost:8000.
Build and run the container:
docker build -t echo .
docker run -p 8000:8000 echoYou can configure the service using the following environment variables:
| Variable | Default | Description |
|---|---|---|
MODEL_SIZE |
tiny.en |
The Whisper model size to use (e.g., tiny, base, small, medium, large-v2). |
DEVICE |
cpu |
Device to run inference on (cpu or cuda). |
COMPUTE_TYPE |
int8 |
Quantization type (int8, float16, int8_float16). |
BEAM_SIZE |
5 |
Beam size for decoding. |
Request:
GET /health
Response:
ok
Request:
POST /transcribe
- Content-Type:
multipart/form-data - Body:
file: The audio file to transcribe.
Example using cURL:
curl -X POST -F "file=@/path/to/audio.mp3" http://localhost:8000/transcribeResponse:
{
"language": "en",
"language_probability": 0.98,
"transcript": "Hello world, this is a test transcription.",
"segments": [
{
"start": 0.0,
"end": 2.5,
"text": "Hello world, this is a test transcription."
}
]
}This project relies heavily on these amazing open-source projects:
- Faster Whisper - Faster Whisper transcription with CTranslate2.
- Starlette - The little ASGI framework that shines.