Watch
1
0
Fork
You've already forked transcribo-backend
0
mirror of https://github.com/DCC-BS/transcribo-backend.git synced 2026-08-17 12:55:24 +00:00
  • Python 97.2%
  • Makefile 1.6%
  • Dockerfile 1.1%
  • Shell 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Yanick Schraner 79a9abafb0 Bump version
2026-08-05 16:58:18 +02:00
.github Update DCC-BS/ci-workflows action to v9 (#60) 2026-07-29 08:25:48 +02:00
.vscode Update pre-commit configuration, VSCode settings, and improve error message in config 2025-02-28 15:01:09 +01:00
scripts feature: merge speaker inference and cleanup into one post-processing agent 2026-07-15 15:01:56 +02:00
src/transcribo_backend Fix logging issues and standardize event naming (#61) 2026-08-05 16:40:54 +02:00
tests fix: fix code rabbit issues in pr 2026-07-30 13:38:44 +02:00
.dockerignore Refactor project structure and update dependencies 2025-12-03 14:33:39 +01:00
.env.example feature(update): We update the backend to make use of faster whisper 1.6 2026-07-07 13:43:25 +02:00
.env.schema feature(update): We update the backend to make use of faster whisper 1.6 2026-07-07 13:43:25 +02:00
.gitignore Update CI workflow for improved test coverage reporting and add VSCode settings 2025-02-27 09:27:10 +01:00
.pre-commit-config.yaml Update pre-commit configuration, VSCode settings, and improve error message in config 2025-02-28 15:01:09 +01:00
.python-version fix deps 2026-03-24 15:30:56 +01:00
codecov.yaml init commit 2025-02-27 09:12:18 +01:00
docker-compose.yml Speaker inference and postprocessing 2026-07-28 10:10:14 +02:00
Dockerfile Fix docker file 2026-05-27 15:32:30 +02:00
entrypoint.sh Fix logging issues (#59) 2026-07-17 11:43:44 +02:00
LICENSE init commit 2025-02-27 09:12:18 +01:00
Makefile Merge branch 'main' into feature/use-faster-whisper-1-6-0 2026-07-29 17:34:45 +02:00
mkdocs.yml Add initial backend configuration and models for audio processing 2025-02-27 18:03:01 +01:00
publiccode.yml Add organisation URI to publiccode.yml 2026-06-11 14:08:01 +02:00
pyproject.toml Bump version 2026-08-05 16:58:18 +02:00
README.md Change readme to add new features for transcribo v2 2026-07-29 11:54:53 +02:00
renovate.json Refactor project structure and update dependencies 2025-12-03 14:33:39 +01:00
tox.ini init commit 2025-02-27 09:12:18 +01:00
uv.lock Bump version 2026-08-05 16:58:18 +02:00

Transcribo Backend

Transcribo Backend is a powerful Python FastAPI service that provides advanced audio and video transcription capabilities with speaker diarization and AI-powered text summarization. This backend service enables high-quality transcription using OpenAI's Whisper API and intelligent summarization using large language models.

Ruff License


DCC Documentation & Guidelines | DCC Website


Features

  • Audio & Video Transcription: High-quality transcription of audio and video files using OpenAI's Whisper API
  • Speaker Diarization: Identify and separate different speakers in recordings
  • Language Detection: Automatic language detection or specify the source language
  • AI Summarization: Generate intelligent summaries of transcribed text using LLMs
  • Speaker Inference: Infer the speaker names from the context of the transcription
  • Title Inference: Generate intelligent titles from the context of the transcription
  • Asynchronous Processing: Task-based processing with status tracking for long-running transcriptions
  • Multi-format Support: Handle various audio formats (MP3, WAV, etc.) and video files
  • Audio Conversion: Automatic conversion to MP3 format for optimal processing
  • Privacy-Focused: Pseudonymized user tracking for usage analytics

Technology Stack

  • Framework: FastAPI with Python 3.12+
  • Package Manager: uv
  • Transcription: OpenAI Whisper API integration
  • AI Models: LLM integration for text summarization
  • Audio Processing: Audio format conversion with audioop
  • Logging: Structured logging with structlog
  • Containerization: Docker and Docker Compose

Setup

Prerequisites

  • Python 3.12+
  • uv package manager
  • Docker and Docker Compose (for containerized deployment)
  • Access to OpenAI Whisper API or compatible service
  • LLM API access for summarization features

Environment Configuration

Create a .env file in the project root with the required environment variables:

# Whisper API Configuration
WHISPER_API=http://localhost:8001
WHISPER_API_KEY=your_whisper_api_key_here

# LLM API Configuration
LLM_API=http://localhost:8002
LLM_API_KEY=your_llm_api_key_here

# Security
HMAC_SECRET=your_secret_key_here

# Client Configuration (optional)
CLIENT_PORT=3000
CLIENT_URL=http://localhost:${CLIENT_PORT}

Note: Configure the Whisper API and LLM API endpoints to match your deployment setup.

Install Dependencies

Install dependencies using uv:

make install

This will:

  • Create a virtual environment using uv
  • Install all dependencies
  • Install pre-commit hooks

Development

Start the Development Server

uv run fastapi dev ./src/transcribo_backend/app.py

Or use the provided task:

make dev

Code Quality Tools

Run code quality checks:

# Run all quality checks
make check

# Format code with ruff
uv run ruff format .

# Run linting
uv run ruff check .

# Run type checking
uv run pyrefly check

Production

Run the production server:

make run

Docker Deployment

The application includes a Dockerfile and Docker Compose configuration for easy deployment:

Using Docker Compose

# Start all services with Docker Compose
docker compose up -d

# Build and start all services
docker compose up --build -d

# View logs
docker compose logs -f

Using Dockerfile Only

# Build the Docker image
docker build -t transcribo-backend .

# Run the container
docker run --rm --env-file .env -p 8000:8000 transcribo-backend

Testing & Development Tools

Run tests with pytest:

# Run tests
make test

# Run tests with pytest directly
uv run pytest

API Endpoints

Transcription

  • POST /transcribe: Submit an audio or video file for transcription

    • Parameters:
      • audio_file: The audio/video file to transcribe
      • num_speakers (optional): Number of speakers for diarization
      • language (optional): Source language code
    • Returns: Task status with task ID for tracking
  • GET /task/{task_id}/status: Get the status of a transcription task

    • Returns: Current task status (pending, processing, completed, failed)
  • GET /task/{task_id}/result: Get the transcription result

    • Returns: Transcription response with text and metadata

Summarization

  • POST /summarize: Generate an AI summary of transcribed text
    • Body: SummaryRequest with transcript text
    • Returns: Generated summary

Health Checks

  • GET /health/liveness: Liveness probe for Kubernetes deployments
    • Returns: Application status and uptime

Project Architecture

src/transcribo_backend/
├── app.py                      # FastAPI application entry point
├── config.py                   # Configuration management
├── helpers/                    # Helper utilities
│   └── file_type.py           # File type detection
├── models/                     # Data models and schemas
│   ├── progress.py            # Progress tracking models
│   ├── response_format.py     # Response format definitions
│   ├── summary.py             # Summary models
│   ├── task_status.py         # Task status models
│   └── transcription_response.py  # Transcription response models
├── services/                   # Business logic services
│   ├── audio_converter.py     # Audio format conversion
│   ├── summary_service.py     # Text summarization service
│   └── whisper_service.py     # Whisper API integration
└── utils/                      # Utility functions
    ├── logger.py              # Logging configuration
    └── usage_tracking.py      # Privacy-focused usage analytics

Acknowledgments

This application is based on Transcribo from the Statistical Office of the Canton of Zurich. We have rewritten the functionality of the original application to fit into a modular and modern web application that separates frontend, backend and AI models.

License

MIT © Data Competence Center Basel-Stadt


DCC Logo

Datenwissenschaften und KI Developed with ❤️ by DCC - Data Competence Center