Skip to content

Commit c1878df

Browse files
committed
improve response formatting
1 parent c6104c6 commit c1878df

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

site/en/gemini-api/docs/vision.ipynb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@
275275
"\n",
276276
"# Retrieve two images\n",
277277
"image_path_1 = \"https://upload.wikimedia.org/wikipedia/commons/thumb/8/87/Palace_of_Westminster_from_the_dome_on_Methodist_Central_Hall.jpg/2560px-Palace_of_Westminster_from_the_dome_on_Methodist_Central_Hall.jpg\"\n",
278-
"image_path_2 = \"https://storage.googleapis.com/generativeai-downloads/images/jetpack.jpg\" # Replace with the actual path to your second image\n",
278+
"image_path_2 = \"https://storage.googleapis.com/generativeai-downloads/images/jetpack.jpg\"\n",
279279
"\n",
280280
"image_1 = httpx.get(image_path_1)\n",
281281
"image_2 = httpx.get(image_path_2)\n",
@@ -287,7 +287,7 @@
287287
"{'mime_type':'image/jpeg', 'data': base64.b64encode(image_1.content).decode('utf-8')},\n",
288288
"{'mime_type':'image/jpeg', 'data': base64.b64encode(image_2.content).decode('utf-8')}, prompt])\n",
289289
"\n",
290-
"Markdown(\">\" + response.text)"
290+
"Markdown(response.text)"
291291
]
292292
},
293293
{
@@ -339,7 +339,7 @@
339339
"\n",
340340
"response = model.generate_content([sample_file_2, sample_file_3, prompt])\n",
341341
"\n",
342-
"Markdown(\">\" + response.text)"
342+
"Markdown(response.text)"
343343
]
344344
},
345345
{
@@ -381,6 +381,15 @@
381381
"Upload the image using [`media.upload`](https://ai.google.dev/api/rest/v1beta/media/upload) and print the URI, which is used as a reference in Gemini API calls."
382382
]
383383
},
384+
{
385+
"cell_type": "code",
386+
"execution_count": null,
387+
"metadata": {},
388+
"outputs": [],
389+
"source": [
390+
"!curl -o jetpack.jpg https://storage.googleapis.com/generativeai-downloads/images/jetpack.jpg"
391+
]
392+
},
384393
{
385394
"cell_type": "code",
386395
"execution_count": null,
@@ -464,7 +473,7 @@
464473
"# Prompt the model with text and the previously uploaded image.\n",
465474
"response = model.generate_content([sample_file, \"Describe how this product might be manufactured.\"])\n",
466475
"\n",
467-
"Markdown(\">\" + response.text)"
476+
"Markdown(response.text)"
468477
]
469478
},
470479
{
@@ -502,7 +511,7 @@
502511
"prompt = \"Return a bounding box for each of the objects in this image in [ymin, xmin, ymax, xmax] format.\"\n",
503512
"response = model.generate_content([sample_file_2, prompt])\n",
504513
"\n",
505-
"Markdown(\">\" + response.text)"
514+
"Markdown(response.text)"
506515
]
507516
},
508517
{

0 commit comments

Comments
 (0)