A robust FastAPI-based API service for transcribing, translating, and generating captions for audio files, with a focus on supporting Kinyarwanda and English languages, featuring comprehensive fallback mechanisms for ensuring reliable translation services.
# Audio Transcription & Translation API
A robust FastAPI-based API service for transcribing, translating, and generating captions for audio files, with a focus on supporting Kinyarwanda and English languages, featuring comprehensive fallback mechanisms for ensuring reliable translation services.
## Features
- **Audio Transcription**: Convert speech to text in Kinyarwanda or English
- **Translation**: Translate text from Kinyarwanda to English with multi-model fallback
- **Caption Generation**: Create SRT or VTT caption files with bilingual support
- **Combined Pipeline**: Process audio through a full transcription, translation, and captioning pipeline
- **Fault Tolerance**: Robust fallback mechanisms when primary models are unavailable
## API Endpoints
### Transcription Endpoints
- `POST /api/transcribe/`: Transcribe an audio file
- `GET /api/transcribe/languages`: List supported transcription languages
### Translation Endpoints
- `POST /api/translate/text`: Translate text from source to target language
- `POST /api/translate/chunks`: Translate transcription chunks with timing information
- `POST /api/translate/audio`: Transcribe and translate audio in one step
- `GET /api/translate/languages`: List supported translation language pairs
### Caption Endpoints
- `POST /api/captions/generate`: Generate captions from transcription data
- `POST /api/captions/from-audio`: Generate captions directly from audio file
- `GET /api/captions/formats`: List supported caption formats
### Pipeline Endpoint
- `POST /api/pipeline/process`: Complete audio processing pipeline (transcription, translation, captioning)
## Installation and Setup
### Prerequisites
- Python 3.9 or higher
- FFmpeg installed on your system
- (Optional) CUDA-compatible GPU for faster processing
### Local Development Setup
1. Clone the repository:
```bash
git clone
github.com
cd audio-transcription-api
```
2. Create a virtual environment:
```bas …