From the course: OpenAI API: Vision
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Vision code for our project - OpenAI API Tutorial
From the course: OpenAI API: Vision
Vision code for our project
- [Instructor] Let's get to work on the core functionality of our application, specifically, the prompt engineering part of it. Now I'm going to go ahead and navigate to our exercise files, to 02_03_begin, and here you'll see that I've created this vision.py file. It really pays off sometimes to isolate the core AI logic into a different file or a Jupyter Notebook. This allows you to work on things like prompt engineering iteratively and see what works. Now here you'll see, at the top, some imports. Then I open this image of a refrigerator and Base64 encode it. This is the image right here. So you'll see that specifically I have soy milk here, and I have apples, some red bell peppers. Not much, and I'm going to head back to vision.py, and you'll see here there's a placeholder for our prompt. And, after that, you'll see that I passed the prompt along with the image to the OpenAI client. Now I'm going to start by asking…