Skip to main content

Code

cookbook/11_models/ibm/watsonx/image_agent_bytes.py

Usage

1

Set up your virtual environment

2

Set your API key

3

Install dependencies

4

Add sample image

Place a sample image named “sample.jpg” in the same directory as the script.
5

Run Agent

This example shows how to use IBM WatsonX with vision capabilities. It loads an image from a file and passes it to the model along with a prompt. The model can then analyze the image and provide relevant information. Note: This example uses a vision-capable model (meta-llama/llama-3-2-11b-vision-instruct) and requires a sample image file.