Skip to content

Commit ff2a162

Browse files
vertex-mg-botcopybara-github
authored andcommitted
Minor typo fixes and prints
PiperOrigin-RevId: 834789027
1 parent d26f081 commit ff2a162

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

notebooks/community/model_garden/model_garden_remote_sensing_deployment.ipynb

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,32 @@
271271
" return base64.b64encode(arr_bytes.getvalue()).decode(\"utf-8\")\n",
272272
"\n",
273273
"\n",
274-
"# @markdown **(Optional)** Override the endpoint id.\n",
275-
"# @markdown *Note: If kept empty uses the recently deployed endpoint.*\n",
276-
"# @markdown *Note: Make sure to use the endpoid id from the previous cell output*\n",
277-
"# @markdown * (Not the endpoint name used above)*\n",
278-
"ENDPOINT_ID = \"\" # @param { 'type': 'string' }\n",
279-
"use_dedicated_endpoint = True # @param { 'type' : 'boolean' }\n",
280-
"\n",
281-
"if ENDPOINT_ID:\n",
282-
" endpoint = aiplatform.Endpoint(ENDPOINT_ID)\n",
283-
"\n",
284274
"# Download sample images\n",
285275
"!wget -O harbor.jpg https://mrsg.aegean.gr/images/uploads/it2zi0eidej4ql33llj.jpg\n",
286276
"!wget -O palace.jpeg https://www.spaceintelreport.com/wp-content/uploads/2021/05/Pleiades-NEO-US-Capitol-30cm.jpeg\n",
287277
"harbor_img = Image.open(\"harbor.jpg\")\n",
288278
"palace_img = Image.open(\"palace.jpeg\")"
289279
]
290280
},
281+
{
282+
"cell_type": "code",
283+
"execution_count": null,
284+
"metadata": {
285+
"cellView": "form",
286+
"id": "Jvdv-GLjKaWN"
287+
},
288+
"outputs": [],
289+
"source": [
290+
"# @markdown **(Optional)** Override the endpoint (use a different one).\n",
291+
"# @markdown This is useful if you want to use a test a previously deployed model.\n",
292+
"# @markdown otherwise the inference samples will use the recently deployed model.\n",
293+
"ENDPOINT_ID = \"\" # @param { 'type': 'string' }\n",
294+
"use_dedicated_endpoint = True # @param { 'type' : 'boolean' }\n",
295+
"\n",
296+
"if ENDPOINT_ID:\n",
297+
" endpoint = aiplatform.Endpoint(ENDPOINT_ID)"
298+
]
299+
},
291300
{
292301
"cell_type": "code",
293302
"execution_count": null,
@@ -309,6 +318,7 @@
309318
" parameters={\"batch_size\": 2},\n",
310319
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
311320
")\n",
321+
"print(\"Image encoder result, should contain 2 instances with embeddings.\")\n",
312322
"print(result)\n",
313323
"\n",
314324
"# Call text encoder with multiple input instances\n",
@@ -322,6 +332,7 @@
322332
" parameters={\"batch_size\": 2},\n",
323333
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
324334
")\n",
335+
"print(\"Text encoder result, should contain 2 instances with embeddings.\")\n",
325336
"print(result)\n",
326337
"\n",
327338
"# Call the zero-shot classification on the harbor & palace image, returns\n",
@@ -335,6 +346,7 @@
335346
" parameters={\"batch_size\": 2},\n",
336347
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
337348
")\n",
349+
"print(\"Zero-shot classification result including similarity scores.\")\n",
338350
"print(result)"
339351
]
340352
},
@@ -361,6 +373,7 @@
361373
" parameters={\"batch_size\": 1},\n",
362374
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
363375
")\n",
376+
"print(\"Image detection result, should contain 1 instance with object-level embeddings.\")\n",
364377
"print(result)\n",
365378
"\n",
366379
"# Call text encoder with multiple texts, returns text embeddings for each input.\n",
@@ -374,6 +387,7 @@
374387
" parameters={\"batch_size\": 4},\n",
375388
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
376389
")\n",
390+
"print(\"Text encoder result, should contain 4 instances with text embeddings.\")\n",
377391
"print(result)\n",
378392
"\n",
379393
"# Call the Open Vocabulary Detection mode with image/texts pairs, returns\n",
@@ -393,6 +407,7 @@
393407
" },\n",
394408
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
395409
")\n",
410+
"print(\"Object detection result, including detection results with 100 objects each.\")\n",
396411
"print(result)"
397412
]
398413
},

0 commit comments

Comments
 (0)