Skip to content

Commit 39da375

Browse files
No public description
PiperOrigin-RevId: 838870503
1 parent 6ac0a8b commit 39da375

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

  • official/projects/waste_identification_ml/llm_applications/milk_pouch_detection

official/projects/waste_identification_ml/llm_applications/milk_pouch_detection/deploy.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@
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"
7173
ZONE="us-central1-a" # Zone for the GCE instance
7274
DEVICE="gpu" # Default to GPU
7375
COMPUTE="gce" # Default to gce
76+
SOURCE_BUCKET_NAME=""
7477

7578
# Parse command-line arguments --device [cpu|gpu] and --compute [cloud-run|gce]
7679
while [[ "$#" -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
104108
fi
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

113116
echo "🚀 Starting deployment for a '${DEVICE}' configuration..."
@@ -130,7 +133,6 @@ echo "Artifact Registry Repo: ${REPO_NAME}"
130133
echo "Image Name: ${IMAGE_NAME}"
131134
echo ""
132135
echo "Source GCS Bucket: ${SOURCE_BUCKET_NAME}"
133-
echo "Destination GCS Bucket: ${DESTINATION_BUCKET_NAME}"
134136
echo ""
135137
echo "BigQuery Dataset: ${BQ_DATASET}"
136138
echo "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."
195191
echo "GCS Buckets are ready."
196192
echo ""
197193

0 commit comments

Comments
 (0)