2323# [--zone=<zone>] \
2424# [--device=cpu|gpu] \
2525# [--compute=gce] \
26+ # [--source_bucket_name=<source_bucket_name>]
2627#
2728# Arguments:
2829# --gcp_project_id: Specify the GCP project ID.
2930# --region: Specify the region for the resources. Default: us-central1.
3031# --zone: Specify the zone for the resources. Default: us-central1-a.
3132# --device: Specify the device type (cpu or gpu). Default: cpu.
3233# --compute: Specify the compute platform (gce). Default: gce.
34+ # --source_bucket_name: Specify the source GCS bucket name.
3335#
3436# Example:
3537# ./deploy.sh --device=gpu --compute=gce
@@ -71,6 +73,7 @@ REGION="us-central1"
7173ZONE=" us-central1-a" # Zone for the GCE instance
7274DEVICE=" gpu" # Default to GPU
7375COMPUTE=" gce" # Default to gce
76+ SOURCE_BUCKET_NAME=" "
7477
7578# Parse command-line arguments --device [cpu|gpu] and --compute [cloud-run|gce]
7679while [[ " $# " -gt 0 ]]; do
@@ -80,6 +83,7 @@ while [[ "$#" -gt 0 ]]; do
8083 --zone) ZONE=" $2 " ; shift ;;
8184 --device) DEVICE=" $2 " ; shift ;;
8285 --compute) COMPUTE=" $2 " ; shift ;;
86+ --source_bucket_name) SOURCE_BUCKET_NAME=" $2 " ; shift ;;
8387 * ) echo " Unknown parameter passed" ; exit 1 ;;
8488 esac
8589 shift
@@ -104,10 +108,9 @@ if [[ "${DEVICE}" != "cpu" && "${DEVICE}" != "gpu" ]]; then
104108fi
105109
106110# [Input] GCS Bucket name for uploading original images
107- export SOURCE_BUCKET_NAME=" milk-pouch-classification-uploads-${PROJECT_ID} "
108-
109- # [Output] GCS Bucket name for storing annotated images
110- export DESTINATION_BUCKET_NAME=" milk-pouch-classification-annotated-${PROJECT_ID} "
111+ if [[ -z " ${SOURCE_BUCKET_NAME} " ]]; then
112+ export SOURCE_BUCKET_NAME=" milk-pouch-classification-uploads-${PROJECT_ID} "
113+ fi
111114
112115
113116echo " 🚀 Starting deployment for a '${DEVICE} ' configuration..."
@@ -130,7 +133,6 @@ echo "Artifact Registry Repo: ${REPO_NAME}"
130133echo " Image Name: ${IMAGE_NAME} "
131134echo " "
132135echo " Source GCS Bucket: ${SOURCE_BUCKET_NAME} "
133- echo " Destination GCS Bucket: ${DESTINATION_BUCKET_NAME} "
134136echo " "
135137echo " BigQuery Dataset: ${BQ_DATASET} "
136138echo " BigQuery Table: ${BQ_TABLE} "
@@ -186,12 +188,6 @@ gsutil mb \
186188 -c standard \
187189 -b on " gs://${SOURCE_BUCKET_NAME} " \
188190 || echo " Source Bucket 'gs://${SOURCE_BUCKET_NAME} ' already exists."
189- gsutil mb \
190- -p " ${PROJECT_ID} " \
191- -l " ${REGION} " \
192- -c standard \
193- -b on " gs://${DESTINATION_BUCKET_NAME} " \
194- || echo " Destination Bucket 'gs://${DESTINATION_BUCKET_NAME} ' already exists."
195191echo " GCS Buckets are ready."
196192echo " "
197193
0 commit comments