Skip to content

Commit

Permalink
feat: add isTemplate var to notebook template (#960)
Browse files Browse the repository at this point in the history
# Description
Modify the notebook template to enable notebook testing. Change
PROJECT_ID and LOCATION cells to use environment variables if the user
doesn't provide a Project ID. Add a cell to load models in the template
to incorporate the isTemplate field.

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
katiemn and gcf-owl-bot[bot] authored Aug 19, 2024
1 parent dd00488 commit ee68fba
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions notebook_template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,17 @@
},
"outputs": [],
"source": [
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\"}\n",
"LOCATION = \"us-central1\" # @param {type:\"string\"}\n",
"\n",
"# Use the environment variable if the user doesn't provide Project ID.\n",
"import os\n",
"\n",
"import vertexai\n",
"\n",
"PROJECT_ID = \"[your-project-id]\" # @param {type:\"string\", isTemplate: true}\n",
"if PROJECT_ID == \"[your-project-id]\":\n",
" PROJECT_ID = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n",
"\n",
"LOCATION = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")\n",
"\n",
"vertexai.init(project=PROJECT_ID, location=LOCATION)"
]
},
Expand Down Expand Up @@ -340,6 +345,27 @@
"# TODO: Add all library imports here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "e43229f3ad4f"
},
"source": [
"### Load model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cf93d5f0ce00"
},
"outputs": [],
"source": [
"# TODO: Uncomment and add model name\n",
"# MODEL_ID = \"\" # @param {type:\"string\", isTemplate: true}"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down

0 comments on commit ee68fba

Please sign in to comment.