This project implements an audio transcription service using Flask, Celery, and OpenAI's Whisper model. The transcription process runs asynchronously in the background using Celery workers, with Redis as the message broker and result backend.
- Create a new directory and initialize a Git repository.
- Set up a Python 3.10 virtual environment and install dependencies.
- Record or download an audio file to test Whisper's transcription capabilities.
transcribe.py - Retrieve Flask + Celery sample code and set up a background task system.
- Launch a Redis server as the Celery message broker.
- Modify the Flask frontend to allow file uploads and retrieve transcription results asynchronously.
- Continuously check the transcription status until the final result is displayed.
Ensure your system has the required dependencies installed.
# Update and install FFmpeg (required for audio processing)
sudo apt update && sudo apt install ffmpegUse Python 3.10, as Whisper does not work well with Python 3.11.
# Install and set up Python 3.10 using pyenv
pyenv install 3.10.0
pyenv local 3.10.0If using Poetry for dependency management:
# Initialize Poetry virtual environment
poetry installActivate the virtual environment from VSCode:
eval $(poetry env activate)
code .poetry add flask celery redis openai-whisperTo start a Redis container:
docker run -d -p 6379:6379 redisopen app.py file:
python app.pyTo start the Celery worker, run:
celery -A tasks.celery_app worker --loglevel=info- Visit http://127.0.0.1:5000 and upload an audio file.
- The server returns a task ID.
- Periodically check
/get_result?result_id=<task_id>for the transcription result.
Copyright Hélène Finot - Formation DevOps 2025