Demo of media pipe python integration with Django
- STEP: Install gcloud
- STEP:
gcloud auth loginchoose the appropriate GCP account - STEP:
gcloud config set project a-counting-sign-language - STEP: Ensure you have IAM permissions to view Cloud Run, Compute Engine, Cloud Build and Artifact Repository in the appropriate GCP account
- STEP: Enable Docker auth to GCP
gcloud auth configure-docker us-central1-docker.pkg.dev
- NOTES: How to create a repo (already done)
gcloud artifacts repositories create REPO_NAME --repository-format=docker \ --location=us-central1 --description="DESCRTIPTION"- NOTES: List repositories
gcloud artifacts repositories list- Or navigate to Console
- NOTES: Console
- NOTES: How service was configures
- NOTES: Setting environmental variables based on sample
- NOTES: Quick Build
- NOTES: Quick Start Deploy
- NOTES: Automating Deploys
- STEP: Setup your env file based on the sample
- STEP:
docker pull us-central1-docker.pkg.dev/a-counting-sign-language/mediapipe/mediapipe - STEP:
docker pull us-central1-docker.pkg.dev/a-counting-sign-language/pjg-mediapipe-demo/pjg-mediapipe-demo - STEP: Building Demo Server Container
docker-compose up
- STEP: Download the latest tar.gz release
- Alternate link
- should be 3.32 GB unzipped
- Unzip the file, should be 3.32 gb
- STEP: load the tar as a docker image with
docker load -i pjg-mediapipe-demo_mediapipe_web.v0.0.1.tar - STEP: Run the image which should be tagged as
pjg-mediapipe-demo_mediapipe_web:latestand image sha782f523505a4docker run -p 8080:8080 --env-file .env 782f523505a4 python3 serve.py
- NOTES:
- Release was generated with
docker save 'pjg-mediapipe-demo_mediapipe_web' > pjg-mediapipe-demo_mediapipe_web.v0.0.1.tarand gzipped
- Release was generated with
- Build Mediapipe Container Locally
- STEP: Taken from https://google.github.io/mediapipe/getting_started/install.html
- STEP: In a sibling folder,
git clone git@github.com:mitmedialab/mediapipe.gitdocker build --tag=mediapipe .- add second tag
docker tag mediapipe us-central1-docker.pkg.dev/a-counting-sign-language/mediapipe/mediapipe- Based on the following instructions
- STEP: Quick Test (optional)
docker run -it --name mediapipe mediapipe:latestroot@bca08b91ff63:/mediapipe# GLOG_logtostderr=1 bazel run --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/hello_world:hello_world
- Building Demo Server Container
- STEP:
docker-compose up
- STEP:
- How images are pushed manually
- NOTES:
docker push us-central1-docker.pkg.dev/a-counting-sign-language/mediapipe/mediapipe - NOTES:
docker pull us-central1-docker.pkg.dev/a-counting-sign-language/mediapipe/mediapipe
- NOTES:
- STEP:
curl -d '{"archive_id": "126f8d71-3116-43b0-8cd5-d7c73cdf8185"}' -H 'Content-Type: application/json' localhost:8080/hand - Run time is 5-7min output is expected here
- https://a-counting-sign-staging.herokuapp.com/transcribe/test/test_fist
- https://a-counting-sign-staging.herokuapp.com/transcribe/test/test_other_heuristics
- https://a-counting-sign-language.s3.amazonaws.com/demos/main_demos_mp4/fist_only/12.mp4
- https://a-counting-sign-language.s3.amazonaws.com/demos/main_demos_mp4/fist_only/fist_only_demo_10_16_20.mp4
- https://a-counting-sign-language.s3.amazonaws.com/46914194/126f8d71-3116-43b0-8cd5-d7c73cdf8185/archive.mp4
- STEP:
gcloud builds submit
- STEP:
curl -d '{"archive_id": "126f8d71-3116-43b0-8cd5-d7c73cdf8185"}' -H 'Content-Type: application/json' https://pjg-mediapipe-demo-czcfo4ghca-uc.a.run.app/hand
- ADD files in Dockerfile with COPY command
- Debugging
- Remove old containers with
docker rm [CONTAINER] - Remove images containers with
docker rmi [IMAGE]
- Remove old containers with
- Run
docker-compose buildto build docker with the file changes - Run
docker-compose upto start docker with the file changes - Run in new terminal
docker docker exec -it [CONTAINER ID] /bin/bash- Run
lsto see new files - You can also do something like
docker docker exec -it [CONTAINER ID] ls /mediapipeto skip the ssh step
- Run
- Run curl command (see testing - cloud and testing - local) or run script or whatever needs to occur appropriately