|
275 | 275 | "\n", |
276 | 276 | "# Retrieve two images\n", |
277 | 277 | "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", |
279 | 279 | "\n", |
280 | 280 | "image_1 = httpx.get(image_path_1)\n", |
281 | 281 | "image_2 = httpx.get(image_path_2)\n", |
|
287 | 287 | "{'mime_type':'image/jpeg', 'data': base64.b64encode(image_1.content).decode('utf-8')},\n", |
288 | 288 | "{'mime_type':'image/jpeg', 'data': base64.b64encode(image_2.content).decode('utf-8')}, prompt])\n", |
289 | 289 | "\n", |
290 | | - "Markdown(\">\" + response.text)" |
| 290 | + "Markdown(response.text)" |
291 | 291 | ] |
292 | 292 | }, |
293 | 293 | { |
|
339 | 339 | "\n", |
340 | 340 | "response = model.generate_content([sample_file_2, sample_file_3, prompt])\n", |
341 | 341 | "\n", |
342 | | - "Markdown(\">\" + response.text)" |
| 342 | + "Markdown(response.text)" |
343 | 343 | ] |
344 | 344 | }, |
345 | 345 | { |
|
381 | 381 | "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." |
382 | 382 | ] |
383 | 383 | }, |
| 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 | + }, |
384 | 393 | { |
385 | 394 | "cell_type": "code", |
386 | 395 | "execution_count": null, |
|
464 | 473 | "# Prompt the model with text and the previously uploaded image.\n", |
465 | 474 | "response = model.generate_content([sample_file, \"Describe how this product might be manufactured.\"])\n", |
466 | 475 | "\n", |
467 | | - "Markdown(\">\" + response.text)" |
| 476 | + "Markdown(response.text)" |
468 | 477 | ] |
469 | 478 | }, |
470 | 479 | { |
|
502 | 511 | "prompt = \"Return a bounding box for each of the objects in this image in [ymin, xmin, ymax, xmax] format.\"\n", |
503 | 512 | "response = model.generate_content([sample_file_2, prompt])\n", |
504 | 513 | "\n", |
505 | | - "Markdown(\">\" + response.text)" |
| 514 | + "Markdown(response.text)" |
506 | 515 | ] |
507 | 516 | }, |
508 | 517 | { |
|
0 commit comments