Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multimodal Update cohere-embed.ipynb #3425

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions sdk/python/foundation-models/cohere/cohere-embed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,35 @@
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For image inputs you can try:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import base64\n",
"\n",
"# Open the image file in binary mode\n",
"with open(\"<Path to Image>\", \"rb\") as image_file:\n",
" # Read the image data\n",
" image_data = image_file.read()\n",
"\n",
" # Encode the image data to base64\n",
" base64_encoded_data = base64.b64encode(image_data)\n",
"\n",
" # Convert the base64 bytes to a string\n",
" base64_string = base64_encoded_data.decode(\"utf-8\")\n",
"\n",
"co.embed(images=[base64_string], input_type=\"image\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Loading