https://github.com/matthieuml/whisper-api
Small Whisper API with a queue system using Celery
https://github.com/matthieuml/whisper-api
celery flask whisper
Last synced: 5 months ago
JSON representation
Small Whisper API with a queue system using Celery
- Host: GitHub
- URL: https://github.com/matthieuml/whisper-api
- Owner: matthieuml
- License: gpl-3.0
- Created: 2023-12-08T10:49:10.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-01T13:02:35.000Z (over 1 year ago)
- Last Synced: 2025-02-01T13:36:32.018Z (over 1 year ago)
- Topics: celery, flask, whisper
- Language: Python
- Homepage:
- Size: 139 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Whisper API
A lightweight API for Whisper transcription, featuring a queue system with Celery. Designed primarily for API calls, it also includes a simple web interface, and a Flower dashboard is provided for monitoring Celery tasks.
## Project Structure
```
├── src
│ ├── api
│ │ ├── files
│ │ ├── models
│ │ ├── templates
| | | └── index.html
| | | └── transcribe.html
│ │ ├── tests
│ │ | └── test.py
│ │ ├── worker
│ │ | └── initialization.py
│ │ | └── tasks.py
│ │ ├── app.py
│ │ └── utils.py
│ ├── Dockerfile
| ├── entrypoint.sh
│ ├── guniconf.py
│ ├── poetry.lock
│ └── pyproject.toml
├── .pre-commit-config.yaml
├── docker-compose-prod.yaml
├── docker-compose.yaml
├── LICENSE
└── README.md
```
## Getting Started
### Prerequisites
Ensure you have [Docker](https://docs.docker.com/engine/install/) installed. For GPU acceleration, it is highly recommended to install the [NVIDIA Container Runtime](https://docs.docker.com/config/containers/resource_constraints/#gpu).
### Setup
1. Clone the repository
```sh
git clone git@github.com:matthieuml/whisper-api.git
```
2. Create an environment file
A template `.env-example` is provided. Copy it to `.env` in the root directory and update the values as needed.
For security reasons, it is recommended to modify these values.
Adjust `WORKER_CONCURRENCY` based on your GPU’s VRAM and the memory requirements of your tasks to prevent failures due to insufficient memory.
3. Build and start the Docker containers
```sh
docker compose -f docker-compose-prod.yaml up
```
Once running, the API will be available at `http://localhost:8000`, and the Celery dashboard (Flower) will be accessible at `http://localhost:5555`.
## Development
### Environment
To work with the development environment and apply changes to the API, use the following command:
```sh
docker compose -f docker-compose.yaml up
```
The app will automatically update on every change without requiring a server restart.
### Tests
To run the tests after starting the container, use this command:
```sh
docker compose exec -T python -m pytest api/tests/test.py
```
### Linting
This project uses [pre-commit](https://pre-commit.com/) to automatically lint the code. To set up the hooks, run:
```sh
pre-commit install
```
The hooks will be executed automatically on every commit to ensure code quality.