Serving Super Resolution Model Using FastAPI and Celery.
-
Create RabbitMQ and FastAPI container(refer to SR-FastAPI)
-
Clone repository
git clone https://github.com/ainize-team/SR-Worker
cd SR-Worker
- Edit docker-compose.yml and .env file for your project.
- Vhost for each worker is in docker-compose.yml and common RabbitMQ config is in .env file.
- Run worker container
docker-compose up -d
# If you want to run a specific worker container, write service name.
docker-compose up -d <service name>
- Run RabbitMQ comtainer as a broker
docker run -d --name sr-rabbitmq -p 5672:5672 -p 15672:15672 --restart=unless-stopped rabbitmq:3.11.2-management
- Clone repository
git clone https://github.com/ainize-team/SR-Worker
cd SR-Worker
- Build docker image
docker build -t sr-worker .
- Run docker container
docker run -d --name <worker_container_name> \
--gpus='"device=0"' -e BROKER_URI=<broker_uri> \
-e FIREBASE_DATABASE_URL=<firebase_realtime_database_url> \
-e FIREBASE_STORAGE_BUCKET=<firebase_storage_url> \
-v <firebase_credential_path>:/app/key -v <model_local_path>:/app/model \
sr-worker
Or, you can use the .env file to run as follows.
docker run -d --name <worker_container_name> \
--gpus='"device=0"' \
--env-file <env filename> \
-v <firebase_credential_path>:/app/key -v <model_local_path>:/app/model \
sr-worker
- install dev package.
pip install -r requirements.txt
pip install -r requirements-dev.txt
- install pre-commit.
pre-commit install
- Check our SR-FastAPI Repo.