This is a lesson preview only. For the full lesson, please purchase the course.

Getting Started
Build web applications using Python’s Flask framework and the OpenAI API, starting from core concepts and assuming foundational Python programming knowledge, while setting up VS Code and an OpenAI account.
Read transcript: Getting Started

Hello, welcome to this Python for AI course. My name is Brian McLean. Thank you for joining me. In this course, we're going to learn how to build web apps using Python's Flask server and the open AI API, better known perhaps as ChatGPT.

So in this course, we're going to start from very basic fundamentals. There's not much in the way of prerequisites, although I will get into those. You will need the class files, which you can download. And you're also going to need to have VS Code installed.

That is a free editor called VS Code, which you can google, free install, very simple setup, Mac or PC, works great. I'm going to show you my app, the web app version of it. It is called ArtMink. And the way it works is you, the user, browsers to an image or images of an antique collectible or other work of art, and submits it for analysis.

To the AI, we'll try this chair, this Windsor chair, and we can do more than one image, which of course you would always want to have if any human were analyzing something. So think of AI as super smart yes, but also kind of like a human in a way, right? They're that smart. They would like to see more than one picture of whatever it is.

This is trying to appraise an antique. Okay, so it's going to give you an age, evaluation, other details. So it kind of would like to have more than one image, just like a professional expert would like to have more than one image. So here we go.

It's probably going to come back and say Windsor chair with knuckles, hands, late 18th century. There you go, late 18th, early 19th. Um, there you go, hardwood. Didn't mention the knuckles there, but you know, it's pretty detailed here.

Authentication, it thinks it's real, and here are all kinds of other appraisals that I've done or that other users have done. So we're not going to be learning how to do this all in the back end and save it today, the basis and such, but in this course, we will learn on the front end how to connect to the open AI API. So I hope that's inspiring. The app is free on the app store, art, mink, mink like the animal.

And yeah, let's just dive in now. So the course is Python for AI apps inside the course folder. You do have a book PDF, which gets us covers a good chunk of the course. Now let's discuss the prerequisites quickly.

You would need some fundamental Python programming skills. You don't have to be the world's greatest programmer, but you do need to know some stuff. Otherwise, it'll just be the builder looking at all this, this code. You do not need advanced Python knowledge.

However, you don't need to know flask yet. You don't need to know data science, libraries, even for that matter, but it would be helpful. Also helpful, but not required, would be some knowledge of HTML and CSS. We're building web apps in the browser after all.

And the structure of the page is HTML and the styling of CSS. Some JavaScript fundamental programming skill on the front end, how to make a button click call a function fundamental basics. You don't need any backend JavaScript node or react. And even if you don't know any JavaScript, again, not required, real helpful, but we'll let you slide if you just have some Python.

And it would also be great if you'd ever use chat GP just as a casual consumer. Have you ever gone to open AI dot com chat GPT and just ask it a question? That would be useful as well. You can always do that later.

So, but now as far as required setup, we do need VS code and you will need which you can download, you can just type, go to Google, download, VS code, the first choice, Windows or Mac click. It'll walk you through the setup super straightforward. Now, here's something that's a little more involved. In order to do this course, we're going to be in this course, we're going to be connecting to what is called the open AI API that is the application programming interface.

Sending requests, receiving responses like you just saw with that antique that I submitted images of, right? I submitted pictures that was my request. It provided a detailed report. So, in order to do that, first of all, you need a subscription open AI, which costs $20 a month and you need an open AI key for your project, which would be free once you have a subscription.

And then on top of that, you have to pay for what are called open AI token credits. So, those, you don't need too many, a few dollars worth would be sufficient. But if you don't have this, it won't work. You won't be able to do these, these, um, these apps at all.

So, now when I teach the course at Noble Desktop in New York City, I just provide students with it in my own, I just make an API key for my own account. I let them use my code token credits is pretty cheap. But for you, you might need to go do all this, or otherwise, get set up. Perhaps your school or institution or workplace will provide you with that.

Sometimes it's just a temporary key to get you through the course someone can provide you with. But we will take a moment to look at how to get an account generated an open AI key. We're not going to get into the purchasing credits right now, but I will show you this part. I'm going to open up this link and I'm already logged in.

So, if you subscribe and we're paying your $20 a month, it would take you right here. It already knows me. That's me. So, I'm going to create a new secret key.

It's not going to be so secret in a moment because anyone watching this will see it. But by the time you're watching this, this key will have been deleted. So, it's not going to work. This is just for the course demonstration purposes.

I'm going to create the secret key. And then I'm going to copy it. And then I'm done. And there's the key, along with my other ones that I have.

So, what we're going to do now is go to VS code, which you need to install. Assuming you've installed it and you're ready to go, you launch VS code and then you go file new window and choose open folder or click that little folder icon and you're going to browse to the folder and hit open. And there you go. And I don't need that.

And I don't need that. And here we are. I have opened the project folder pointing at the class files, which you need to have as well. Right.

The class files for the course. I'm not sure if I mentioned that, but there are some files that you need. So you download, unzip the files and then you point to them. Open folder, right.

Browse to the folder, click on it and hit open. You can back up and watch that again if you need to. We have done a done folder and then I'll start folder with much less stuff in it. So I've got this API key file.txt file.

I'm just going to paste that API key. We won't need that for a while, but when we do need it, we'll come back and get it here. We have a basic HTML page to start. I'm just going to launch that right now.

It's just a little static welcome page. And we've got some text that we'll get into later. This text is written in what's called markdown. It's kind of like a read me file format.

It's just a bunch of FAQ style text that might be associated with a website is for our fictitious tree nursery website. So what we're going to do is interface with with chat GPT, right. Build an app where chat GPT is sitting as a chatbot on your website and your web page. But of course, chat GPT isn't going to know about your tree nursery business, right.

So we're going to supply all this data to chat GPT in our prompt when we send our request. So the consumer will be asking, hey, do you sell apple tree saplings? And it'll be like, yeah, sure. And then it'll actually be able to mix and generalize knowledge.

So like what's the best climate to plant my apple tree? Do they need a lot of sunlight? Like things that aren't even in there or in here, it would know because it just has this great fast generalized knowledge. So we've got a little bit of set up.

There's like one image, AI generated, keyed C bunny. So a little bit of CSS for our site. So you don't have to, you know, so it looks nice here. We're not going to get into writing a lot of CSS in this class.