This project provides a sign language translation service using MediaPipe for keypoint extraction and a fine-tuned Whisper model for translation. The service is deployed on Google Cloud Run and managed with Terraform.
sign-language-translator/
├── app/ # Application code
├── terraform/ # Infrastructure as Code
│ ├── environments/ # Environment-specific configs
│ └── modules/ # Reusable Terraform modules
├── build/ # Build configurations
└── setup/ # Setup scripts
sudo apt-get update
sudo apt-get install python3-dev build-essential
./setup/init-gcp-project.sh
cd terraform/environments/dev
terraform init
terraform plan
terraform apply
# Option A: Recommended - Using Virtual Environment
# This keeps your project dependencies isolated and prevents conflicts
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r app/requirements.txt
# Option B: Direct Installation
# Not recommended but faster for quick testing
pip install -r app/requirements.txt
# Option 1: Default behavior
python app/main.py
# Option 2: Explicit mock configuration
export USE_MOCK_MODEL=true
python app/main.py
export USE_MOCK_MODEL=false
export HUGGINGFACE_TOKEN=your_token_here
export MODEL_PATH=your-org/sign-language-translator
python app/main.py
docker build -t sign-language-translator ./app
docker run -p 8080:8080 sign-language-translator
docker build -t sign-language-translator ./app
docker run -p 8080:8080 \
-e USE_MOCK_MODEL=false \
-e HUGGINGFACE_TOKEN=your_token_here \
-e MODEL_PATH=your-org/sign-language-translator \
sign-language-translator
module "cloudrun" {
source = "../../modules/cloudrun"
project_id = var.project_id
region = var.region
environment = "dev"
env_variables = {
USE_MOCK_MODEL = "true"
}
}
module "cloudrun" {
source = "../../modules/cloudrun"
project_id = var.project_id
region = var.region
environment = "dev"
env_variables = {
USE_MOCK_MODEL = "false"
MODEL_PATH = "your-org/sign-language-translator"
}
secrets = {
HUGGINGFACE_TOKEN = {
secret_id = "huggingface-token-dev"
version = "latest"
}
}
}
curl http://localhost:8000/health
# Using your own video
curl -X POST -F "video=@path/to/your/video.mp4" http://localhost:8000/process-sign-language
# Using the example ASL video
curl -X POST -F "video=@app/data/samples/asl_example.mp4" http://localhost:8000/process-sign-language
You can find an example ASL video in the repository at app/data/samples/asl_example.mp4. This example video is sourced from Pexels, a free stock video platform.
Variable | Description | Default |
---|---|---|
USE_MOCK_MODEL | Use mock model instead of real model | true |
HUGGINGFACE_TOKEN | Token for accessing HF model | None |
MODEL_PATH | Path to HF model | your-org/sign-language-translator |
PORT | Port for the application | 8000 |