From the course: OpenAI API: Vision
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Vision API basics - OpenAI API Tutorial
From the course: OpenAI API: Vision
Vision API basics
- [Instructor] Before we start using the OpenAI API for image related tasks, let's see how this part of this API works. So here in my exercise files, I'll navigate to 01_02_begin. And in this folder there is a image of a mug with a robot and some text printed on it, as well as this Python file called test_vision.py. And if I open test_vision.py, you'll notice that at the top, after some imports, I instantiate an OpenAI Client. Next I define an image_URL, and I also open this adjacent file and base64 encode it. When it comes to using this API, it's going to be very similar to text-to-text tasks. But the difference is instead of giving it just text, we can give it either an image or an image as well as a text. So here I create this completion, and in the content I have a content of type image_URL where I can either pass in this string with the base64 encoded image interpolated into it. I can also pass in the image_URL.…