Build RESTful APIs with FastAPI in Python

Krish Naik · Intermediate ·🔧 Backend Engineering ·1y ago
Skills: API Design90%

Key Takeaways

Builds RESTful APIs with FastAPI in Python, covering API development and performance

Full Transcript

Hey, hey, hey. [Music] [Music] Hey everyone. Uh, a very good afternoon. No, evening. Sorry. A very good evening. How are all of you? Yeah. So, can you let me know in the chat if you're if I'm visible everyone? Quick yes or no? Hello everyone. So yeah, I hope I'm visible, audible and let me add third thing which is going to be the screen. Okay, screen one. Yeah. So I prerequisite for the class uh not no prerequisites uh no prerequisites at all. Everyone should be fine. If you are complete fresher or anything I will explain in such a way that you are able to understand along with that yeah we'll make sure that it is a lot easy. So I will be explaining you in an easy manner. Okay. So let's see how that overall gets up. Yeah. Okay. So I might have to share the code with all of you as well and that should be good. Great. Is it going to be recorded? Yes. Uh hopefully it will be on the YouTube only. Hopefully if there is no issues. So yeah. DSA series when uh Madan DSA I'm planning on my channel. So yeah fine. Everyone can you just let me know if this uh steam is lagging or anything with that? Uh is everything all is good? Can you just quickly let me know? So someone is saying steam is lagging. I hope that is not the problem. Let me meanwhile add the screen and let me have this overall thing. Yeah, I think now it should be a lot good, right? Okay, your video is lagging. Can anyone else as well check? H bit lag. One minute. Let me check. One second. Shouldn't be there. Uh just a minute everyone. Okay, let me quickly check. Why is it tagging? So that you can get the best experience. So maybe what I can do is I can turn off few things. Can you tell me now as well everyone? Is it still lagging commands? Yeah, cool. Uh, is it still lagging everyone? I hope now it should not. Uh, just a few things were open in my laptop so I've shared closed them off. Uh I hope now it should not be the problem right? And yeah, I think it's fine now as people are saying. Okay, so yeah, this is the best laptop for deep learning and neural networks. Kupad, if you just want to learn as a student, believe me, any laptop should work. U preferably, I will suggest Mac, M11 or this M4. So yeah, that should be good and don't spam please. Otherwise, you will have to go to Windows uh where again you can buy any laptop which is having a nice GPU and let's say at least 16 GB of RAM. Now, uh at least 1 to2 GB of storage. I personally have left Windows around 2 three years ago. So, not a lot updated on the latest GPUs or anything. So, hopefully that will be you can figure it out. Okay. So, there are no jobs uh for fresher in the IT sector in India. It is not the case. Now, we will have to go by using fake experience. That will also not work. Okay. So yeah cool. So let us start everyone. First let me quickly introduce myself. So I'm Karval. I hope many of you will be aware who I am. I have gone a lot live now. So basically the idea is that today we will be doing fast API which is an awesome framework and today I will be teaching you in a little bit different manner. So the idea will be I'm going to teach you from scratch with a very basic mindset that how I personally reach out to a technology. Okay. Share your channel link. Okay. Sure. I can share that. So, Madan, this is my channel link everyone. This is my LinkedIn link. Okay. Let me see if I can open my LinkedIn here to show you who exactly I am. So, that's a quick Yeah. See. Yeah. So, this is me educator. Uh I'm a graduate of NSIT. I have previously worked at Goldman Sachs Mickle. Currently, I'm working on my startup and I teach you many things, right? DSA, big data, all these things. Uh you must be seeing me where I'm teaching you. Connect with me on LinkedIn as well as I have a YouTube channel as well. Someone was asking on the DSA series uh that I will be bringing on my YouTube channel. So yeah, you can just go and follow me on my YouTube channel. Again, I'm just doing this. Okay, cool, cool, cool. Let me just meanwhile uh her lead problem will also be there Raman. So should be fine. Uh I am not Krishna Tama but it should be fine. Okay. Yes, it's a totally beginner friendly thing. Let me just add it here. Totally beginner friendly fast API introduction. Okay, totally beginner friendly like the idea will be I will tell you how I normally reach out to any problem. So based on that, let me see how well I can teach you that how you have to reach out to a problem. Okay, any new framework. Cool. Uh let me now just see and ask some of your doubts. Okay. Meanwhile uh just one thing more everyone. So we are bringing this course. Okay. So I'm sharing the link and since uh I am a little generous I think you can use the coupon code which is my name. So if you will go here and use the coupon code may hopefully it will apply 10% discount. And yes please make that you can do the same. you use this discount and get yourself enrolled. Everyone in this course we will be covering each and everything starting from Python from complete scratch and we are keeping a very nice approach this time where we will be focusing on use case which can make you ready by uh for your generative AI right so if you want to get started in AI that is where this co uh course will basically end and have the geni boot camp as well you can see the full slavers and everything let me share the link with you first okay And as I said you can use my name as the coupon code. So mayank easy coupon code nothing else. Okay. And yeah okay that should be fine. H let me meanwhile answer any doubt. If anyone has any doubt regarding the course do let me know on that as well. Many fishers many people were asking us that they want to get started with AI geni agentic AI. So in this course we are making sure that the full base is set so that you can give interviews you can get started with AI. Uh again doing that without any knowledge or anything will be very bad. So yeah this course cover everything. Let me just share the slabs with you as well. Okay the whole idea if you will go through slavers it is a lot. You can see all the mentors as well. So me I am here Krishna is there other India faces will also be there. Right. uh it is going to start on Python foundations. So basic Python I think all of us are aware of this right. So yeah Python we will be starting from scratch. Then we will move forward to advanced Python programming. There we will learn about oops, file handling, modules, exception, concurrency, parallelism, simple things starting then with pandas, then numpy, then data visualization, matt plot lip, sebon, plotly, right? The classes are going to happen. So there is a whole like this overall page has everything. They are going to start from March 22nd. They will be live classes. You will be getting the recording, the dashboard access, everything on the Krishnag Academy. Saturday, Sunday 8:00 p.m. to 12:00 a.m. That is going to be the class timings. It's a 8 month long batch. So by the end of this batch, we will make sure that you are interview ready. You are having lots of overall confidence in the AI skill and all these things. Okay. So if you have any doubts related to batch, do let me know. Let me clear the doubts pretty fast and then start so that it will be helpful. Okay. Please can you tell me when you going to teach full fast API in this video? future going to uh we are going to cover it in this video only uh s okay so yeah how long will the class take 8 months uh 4 hour class weekend no class okay coupon code is may everyone okay it's my name pretty easy okay people used to get confused in the numbers and stuff so I made it pretty easy this time okay sir is it companies and AI companies are different uh no okay Cool, cool, cool. Let me ask your doubts uh so that someone in the comment afterwards can see that video start at this point and he will miss out on all the doubts. So yeah uh let me say sir I want to make API of a game. So after watching the live will I be able to make it? Yes, you will get that idea of empire because I will be talking and telling you in the proper that how you can do that. Okay. Uh so it's going to be a single video. I'm going to just teach you the basics about fast API so that you can start and work on that. Okay. Yeah. Everyone just ask your doubts again. I have to go a lot above if anything is there. Any placement in the course? Hisham. Uh personally I can just say that if you do the properly you should be able to get placed for sure. There is no guarantee. Okay. So yeah I hope that answers. Although if you do pretty good we also are hiring for our startup. So we are also hiring for the content but yes should the skill should matter right skill should be there. Cool everyone so should we begin uh or any other doubt is there clear let us start. If no doubts are there we will start and yes I will be teaching in a very very easy to understand manner. Okay, to be real honest, uh I have a lot of experience with writing and like to be drawn API, but I will be teaching you in a very easy to understand manner which I hope you will appreciate. If you have any doubts, please make sure that you ask them. Uh I'm sharing the link again. So this is the link. Okay, then this is the uh this is the coupon code. This is the SLS like I will just quickly go through the SLS once again. So you have the whole idea. Okay, I will be doing it pretty quickly right. So we have the data visualization with Python where we have mattplot lib seon plotly then advanced SQL and database management. So understanding SQL what exactly again idea on this but how you can do the joins advanced SQL then if you move forward NoSQL with MongoDB again very much similar operations quering MongoDB all these things will be there foundation of stats and probability. So data science which we say right uh and one more thing everyone we will be keeping a very open approach this time where we will be teaching you things which are required majorly in today's world in today's interview scenario for uh for your let's say AI related job. So in this we have specifically made sure that we will be teaching in a unique way not like the way it used to like taught five years back in a pretty much new way we'll be teaching. Okay. Are you guys conducting any hackathon? Yes. So in our courses we regularly conduct hackathon. Just right now I have sent a email to my big data course. Okay. So yeah uh there are absolutely no prerequisites no DSA needed. Nothing is needed. Okay. Mang is the code and as the course start this Sunday uh sorry this Saturday. Please make sure that you all quickly enroll if you are planning to. If you have any doubts ask that as well but the idea is that yeah fine after this live stream ends video will be posted uh it should be I cannot guarantee on that okay because sometime we face issue with that so best is to see the live stream I think anything else is also there cool ja cool everyone good to doubt please ask them let me meanwhile complete this thing foundation of stats and probab advanced statistical infer and hypothes hypothesis testing. Uh P test, L test, these tests are very much helpful here. Okay, just move one thing. One minute everyone. Cool. Ah yes. Yeah, now I think all of you should be good. Let me just make a little change. Uh, one minute. Class starts this Saturday. Okay. So, enroll quickly. We have limited seats, of course. And save. Let's keep it. Yeah. The zero for fresher. Yes. Uh that should be the case. Uh coupon code I think all of you know can see the bottom. Okay. Name like why I kept it easy. We were having some 15 10 or something like that. I kept it very easy. May my young 10. Okay. So yeah the course is going to be from complete scratch. If you don't know anything you should just have a laptop for sure. If you're not aware about Python about anything, please join the course. That should be fine. Okay. Is today course related to AI? No. Everything cannot be related to AI. So yeah, stream lagging again. Just a minute everyone. Not sure why. Is it fine now? Or let me change the internet once quickly to the local one. Mhm. One minute everyone. Let me just Yeah. Yeah, now I think everything should be good everyone. So, sorry for the break. Okay, can you just please quickly confirm if this is good or not everyone? Uh, I have changed the internet so this one should not break. Okay. Uh, as I have just answered your question just this video, okay? Please don't spam and let us start. So yeah today what we are going to cover is something known as fast API. Uh yeah this framework we are going to cover everyone. Okay I hope all of you are able to see my screen. Can I get a quick yes on the screen and everything is required not at all like typically it would be better if you know Python otherwise as well uh it should be good if you don't know Python. To be very honest I will be teaching in a little bit that way. Just try to understand okay that should be better. Huh? Cool. So yeah, agenda is going to be this everyone. I'm going to teach you a little bit about API about fast API in general. That is what I'm going to do. Teaching you in a way. I will normally reach out to any new framework. Okay, that is the whole idea. So not any I will see I have a project in mind as well but we will see how that plays out. But the thing is that I will tell you how exactly we go through a project or sorry through a framework. So let's say today it is fast API tomorrow it can be some other framework. how exactly we go through them and try to understand these things. Okay, cool. So let me just quickly go through the slabs and then we are going to start in a couple of more minutes. Uh as I was covering in the slabs module 9 you can see advanced statistical inference and hypothesis testing. Okay, all these things we are going to cover there. Then feature engineering and data pro pre-processing very very important concept. Okay, after that EDA for detailed insights this is going to be complete from scratch. You don't have to worry about anything. Maybe I can write it somehow. Scratch. If I can write it. Scratch. Okay. My iPad is actually not uh working today. So that's why I will have to write it like this. Okay. Scratch. Okay. Nice. Yeah. Cool. I hope it is readable. Let me just have this. Yeah. So, uh EDA we will be doing everyone. Then next we have machine learning foundations and technique. We will be teaching you about machine learning, deep learning, ML, AI, basically all these things. Then machine learning foundation and techniques. We will be covering all these algorithm which you can see in front of you. Okay. Moving forward if we see then we will be starting with NLP for ML. Very very important with AI request uh AI understanding as well. Then moving forward we have the deep learning and neural networks. Okay. Something which you're going to cover in depth again. Then you will see that uh in this deep learning and neural network a lots of topics are covered. Okay. Moving forward we will go to CNN. Surely we have to work with images as well. Right. Then it is CNN foundation YOLO model everything. Then we have RNN and transformer model. So if you will understand we are slowly and gradually taking you to AI right that is the whole idea of this course. So the idea of this course is if I can just explain uh so let's say if this is you okay this is you right and you take this course you take this course so let me say course towards the And you are going to be a minute. Yeah, you are going to be AI ready from okay course and don't know anything. So, Python and everything is going to be covered. Okay. So, yeah, that is the case. Cool. Uh I hope this gets a lot of idea. Again I'm just sharing the link and slave us okay when will the class start bus two two three more minutes okay I just have to quickly cover this because many people will have the doubt then so yeah just two three more minutes maybe okay so yeah because from last 10 minutes onwards we are relating watching code related let me cover the okay then RNN transformer normal model again we will be teaching then introduction to genai okay so generative AI we will be covering vector database vector database rag we will be covering about different types of rag how to integrate them in your code lang chain lang graph all these proper uh your frameworks then uh let's move forward end toend AI project implementation so in middle as well there will be many projects and yeah that is how you we will be making you properly okay cool cool so yeah let us move forward everyone let me have this uh slaver and for people who were saying that yes from the last 10 minutes we are listening about the course well I have to cover the slave now how will I do before that cool so yeah let us start and let us continue everyone let's talk about API in general and you will see lots of things which I have taught okay see good good diagrams I have created but anyways let us move forward let's talk about API in a very easy to understand manner Okay. So let's say this is you again, right? This is you again. So yeah, this is you. And let's say you go to a restaurant. Okay, you go to a restaurant. Okay, why is this messing up? Wait a minute, everyone. I think the overall zoom thing. Yeah. Okay, cool. Sorry, I had it all zoomed out pretty badly. So that's why it was giving an issue. So yeah, again this is us, right? And we are trying to have some thing to order from a restaurant. Okay, just let's say pretty simple use case restaurant. uh spelling I hope is this only please don't beat me up for the spelling okay now you as a person surely there will be some exchange right there will be some exchange yes or no everyone how many of you are understanding that there should be either you will be giving the order either you will be making sure that uh let's say it is open some checks or something will be there there will be some information exchange here yes or no right wrong anything please be a lot active on chat the way I teach I want students to be a lot active on chat. Okay, I'm teaching in a very easy to understand manner h everyone anything any doubt as of now any doubt please reply so that I can move forward. Great. Now in a similar manner like we interact with things okay so I'm interacting with you all our web pages or our applications like web applications mobile applications they need to interact with the overall database or some information right so our overall any application right even if I create let's say Google even if I hit Google if I go on inspect okay and here I go on network it will be making lots of these calls Okay. So it can be making some different different calls. The idea is that Google will be getting this information this Google homepage link this India all these information it will have to get from somewhere. Okay. So the that is the very very basic thing about API in a very very simple manner. Okay. I'm keeping it very simple again to make sure that everyone understand it. Just to get some information we use API. Everyone clear with this easy understanding? Yes or no? Clear with this easy understanding. Yes or no? So the topic for today is fast API. Okay, which is going to help you creating these APIs through which you can get some information, you can send some information. That is the whole idea. Is this thing clear everyone? Yes or no? Anyone has any doubt? making it very very dumb down version. Okay, because I promise that it will be for everyone. Okay, so these are all the benefits which fast API people are saying that hey it's a modern okay modern means high performance web framework for building APIs with Python based on standard Python type hints simple language it will help you to create let us do one thing let us do one thing let us just uh go and install this okay let us install this that is the very first thing which we are going to do okay so let me go to VS code. How many of you are aware about this VS code thing? How many of you are aware about VS Code? This overall thing which I have opened open it with me so that we can code together. Okay, pay attention. I'm just going to copy this. Okay, and I'm going to pip install it. A minute. I think it is not getting copied. No worries. Pay attention. So this is what I have to run. Okay, I'm copying it specifically. Copying it. Copy. And let me paste it. What this is going to do is it is going to install this library onto my system. Okay. So, okay. What is the issue? It is giving uh pip install. Uh 1 minute. Okay. Simple issues. No worries. Pip install. Uh hopefully you will not get that. I was just doing some testing and something that's why we are getting it. Okay. So brake system fast API standard and let us install this. See it is just installing this library. Okay. Fast API it is installing. Nothing else I have done. Is this step clear everyone? Is this step clear? Can I install using cond? You can install using anything. Should be fine. Totally fine. Once we have installed this, uh we will be installing one more thing. Okay. I think uh yes, I actually just copy this code. So I'm just copying this from internet. Okay, nothing else. I'm just copying this full thing as it is from here. Okay, let me create a new file which is going to be main. py and then I will explain you like what exactly is happening. Okay, I have just copied this as it is if you can see right and now what we are going to do pay attention everyone we just s just trying to follow what they have given on the homepage. So they said that okay first thing pay attention everyone. They said okay my or all of you please first make sure that you install this library pretty makes sense if I have to use anything I will have to install this. How do we play any game on the system? We have to first install that right many of you must have played games on the laptop we have to install them first. Great. Then these are all those files or this file you have to create. Okay so I've just created this file as you can see. Now let me just run this. So how are they saying to runner? Run it. Fast API def main.py and let it run. See it is saying that this server okay it is running on this particular link. Okay. So let me go here and see. Are you able to see that it is giving me a hello world everyone? It is giving me this hello world. Hello world pretty yes or no you are going very basic a that side yeah I will ramp it up let's start basic and then I will ramp it up clear yes or no now let's say instead of hello world I want to send some other information I want to send hello this is very important information okay let Let me let me just run it. See instead I'm able to get this information. Now so with that let me explain you what the whole idea about APIs and stuff is this is our front end. This is what you are seeing on Chrome. Okay. This thing we are able to send some information. Okay. We are able to send some information here. In a similar manner we should be able to get some information as well. Now pay attention when I hit this server when I hit this particular server I was able to get hello this is a very important information similarly I have this item endpoint as well so we say this as endpoint okay so let me do one thing let me this time hit this items and let's say 1 2 3 and you will see I'm getting item ID 1 2 3 and Q I'm getting as null again very simple thing are you able to understand that there is a data there is a very very data exchange here. Are you able to understand that? Thanks SLC. Uh totally appreciated. Today one is very basic because I wanted to show you that I can teach any person. Okay. Is this data exchange thing clear everyone? Yes or no? That some data is getting exchanged. This is data only. Now what is this? This is data. Now can you make this data very very complex as much complex as you like? Yes or no? But right now I'm just sending two keys. Maybe I can send thousand of these keys. Will that data get complex? Yes or no? Exchanging means uh Vishu that some data uh I am reaching out to this particular items 1 2 3. Okay. So I am sending this 1 2 3. Okay. Data exchange means that just like you and me can exchange money. I am giving you money. You are giving me money. Okay. Similarly, this is also getting reached out here. It is sending you this item ID and null. It is sending you this thing. So, in a way, I have a server. Okay. So, we say this in this language. Pay attention. I have a server here. Okay. I have a server here on which I can hit to send the information and it can also send me back some information. Pretty easy thing. That's in a real way. That is the basic idea about API. Nothing else. N vishuj there is one server there is just one server okay no two servers this is your client we say this as client if I just want to go a little bit deep so yeah again I'm keeping it very basic everyone but I will ramp it up don't worry first make sure that you understand this thing okay cool now if we are able to get this information okay so let me do one thing let me go to skelly draw and draw this in a similar manner Pay attention. See this and this and we said that we are exchanging some information. Okay. Now if I go back, do you think that always I will be having information present here only? Don't you think we should ideally have some database some Excel sheet somewhere where my data is kept which I should be getting back or throwing back? Just understand if you go on Amazon do you think Amazon if I go on Amazon let's say Amazon.in Okay. Do you think all these things are hardcoded or something? No. Right. It is trying to get these things. It can change tomorrow based on what I'm getting. So some complex thing. Okay. Some complex thing. It can be an Excel sheet. Okay. It can be a notebook. You can write on your notebook. It can be a database. It can be a SQL based database. Okay. Don't you think these kind of a thing will be helpful? Will be required if I want to have some data information stored with me. That's why come the overall word database idea getting clear. Let me make it more clear. See SQL DB icon. Okay. So let me have this remove this and let me add this database here. Let us make it small and we can have a database here. Okay. So this is the basic idea behind the overall way things happen. Very very basic. Again not making it difficult as I promised what fast API helps you to do is fast API help you to make this server fast API okay it will help you to make these end points as of now see I can hit on this empty one this means that it is empty so if I don't have anything here pay attention if I don't do anything here just this it is empty it is giving me hello this is very important information if I hit on may will I get anything tell If I hit on my end, will I get anything? How many of you think I should get anything or I should get error? How many of you think this? Tell me quickly. Let me hit it. I'm getting detail not found. I'm getting detail not found. What does that mean? Have I defined my here? Have I defined my yank here? No. Right. Let me tell you what fast API in again I'm keeping it very very simple. Okay. So that each and every one of you can understand what fast API help you to do is fast API help you to create this server here. Okay. Via which you can hit and get your information exchange. So all that data exchange everything CP engine I view this fast API. My app is fast API. So I don't need to worry how this is getting up and everything. All that thing fast API has made very easy for me. This is all the role of fast API. Nothing else. So it's a library which is helping you to create your server, create your endpoints. And can you say that it is very fast? I can say that it's very very fast and easy to use. Pay attention. Don't you think this is the case everyone like just to show you let's say if I remove this okay I don't need to refresh or anything if I go if I see if I refresh it it is removed it is not even asking me key first stop the server you have made some changes normally it happens if you are in a restaurant you have a menu you change something in the menu let's say you change the prices what you have to do you have to change the full menu you have to first stop giving out that menu and then you change it but fast API is like link which you are sending to your customer key that's QR code scan the QR code any changes you have you will make it on the go make sense I hope that makes sense is it faster than Django yes they claim it so you will see that they have very good claims here though a very experienced developer in me will like not comment on that directly because it depends on lot of other use cases as well like what all you are But as per them they it is a lot fast. Increase the speed to develop features by 200 to 300%. Reduce 40% of developer error. Great editor support completion everywhere. Less time debugging. So they kind of say that okay they are very fast. Direct comparison I will never do because as I said I as an experienced developer it depends on a lot of things. Okay I hope that is clear everyone. Again very very basic thing I have done. nothing nothing I I can think even a 10 year or 15 years old will understand with this the whole idea is key you need to get some information out in in just like in your school you have a register which is created you have a principal so let us make it more easy let us make it more easy this is a student this is let's say a principal or let's say this is a teacher this is the student database student DB friend role number what is the role number of your friend If you want to get that your teacher can look up. So you can say to your teacher tell me this she will tell you. If you are saying hey change my name or change my thing that is also some data exchange which you are doing. So yeah that is just the case. Clear. If my use case is only to host API then is fast API preferable than Django. Yes it is easier to be honest. Uh it is easier and it is faster in the to develop. Performance- wise we might have to check for multiple cases. Okay, is it clear everyone now? Is the whole idea clear now? How can I use this API in rag app? Sundep, can you tell me what do you understand by rag app? Okay, are we supposed to follow the steps with you? H you can I hope that is clear everyone? Anyone has any doubt? Will you be teaching how to deploy also? Yes, I have the plan for that. Okay, so let's start a project. Let us create a quick quick project. Let us try to create a quick project. Should we make it everyone? We will make a personal task manager. Personal task manager. Okay. I've just given you this idea. Nothing else. Okay. So, let's create that. Requirement.txt. Uh let me just create a new environment. How can I create create new environment? 1 minute. Yeah, let me stop this. Okay. Terminal. New terminal. Previous one. Let us kill this terminal. So, I'm killing it. See, now since I have killed it, it will not be able to hit it. See, it is giving side cannot be reached. Which means that uh let's say Amazon is down. So, you cannot reach that. That's the whole idea. So, server is down. Okay. who mostly works in fast API, software developer or web developer or data engineer. Chin again uh can you understand one thing the way I taught you that it is just for data exchange so anyone can use it depending on the project and everything just that is the case you need it for data exchange it is not data engineer will not use it data scientist will use if my API if the work which I'm going to do is very easy anyone can do it clear everyone yes or no good to start good to start yes or Yes. No. Anything please tell me? Clear. Great. So, uh uh how many of you are aware about this requirement txt read me the structure overall main. py all these things. How many of you are aware about this? How many of you are aware about this? Oops. How many of you are aware? Oops. Oops. Not oops. Oops. So, I'm sharing a video as well if uh you would like to see that. Okay. Uh let me go to my channel only. So, everyone this is my channel here. If go and see a video, this is 47K and I will show you the uh comments. Okay, it's in 343 comments. Okay, if you have any issues with oops, please try to see this video. Every doubt will get clear. So, I'm sharing this link with all of you. Okay, please go through this video and do follow me on my YouTube channel as well. I have the content created which I will be adding soon. Uh yeah, so yeah, that is good. Cool. People are saying that they are aware. If not, again, I will be teaching it in a similar easy manner. So, you don't have to worry about anything. In a personal task manager, what all do you think we should have? What all do you think we should have? Can someone tell me what do you think we should have? Roster high level overview is kind of done. Please like we have been live since last 40 minutes. Okay, let me actually do a thing because many people might not be aware about this. We will follow a single uh file thing. Okay, again totally dependent on us. Either we can maintain a single notebook for all the subjects or different different subjects different notebook. I'm going to maintain a single notebook so that it is very easy for you to understand. Okay. So let me just uh close this. Let me just get rid of all this for the time being. I'm closing all this. Okay. So let us start now. Pay attention now everyone. Uh I still have this app fast API. Okay. I am going to from typing import union from fast API import this fast API and a HTTP exception. Okay. Exception are there for issues and everything. Okay cool. From here my fast API will start. I don't have to have any problem. Okay, cool. So let us move forward. First I'm creating a task DB. Now I can have this as a SQL Excel register anything. I am making it as a Python list. Can I make it as a Python list everyone? Yes or no? Uh I will explain. What is this app? Get don't worry. Okay, where we use mayang code? Uh, so there was a SL course which I discussed on everyone. Uh, you can use the code may here. Cool. Ch. Uh, let us now do one thing everyone. Okay, let us just try to code here only so that we don't have any problem whatsoever. Now pay attention. We have our app. We have our app here. Fast API. Okay. What is this HTTP extension exception? Uh to make sure that I can show the error, this is where this exception is going to use going to get used. Okay, exception handling. Exception handling is an important concept again something which we will cover in our course which you should be aware about if you have a error how you can gracefully handle that. That is all the things. Okay, cool. Uh I think it would be better to go with the folder should be fuj I don't care okay I keeping it very easy today I can make it complex and everything let us keep it in a single file that should be fine now the very first thing which I'm going to do is I'm going to create a class task create okay in this I am just having this base model okay and in this I am just creating so somehow this is pretty good title which is a string Okay. Then I'm creating a description. So description of my task which is also a string and I want a owner as well. Owner which is a string. Is this clear everyone? What I've created here I have just mentioned few things about my task. Nothing else. And this base model is something which we will just import. So we will read more about this import base model. Okay. So we can read about this uh pyantic again is something I don't want to go there. Let's just keep it to fast API only. Okay. Is it clear everyone what I've done here? Anyone has any doubt here? Anyone has any doubt what I've done till now? And I will create another task response. Okay, which will have my uh task create. Okay. So I'm inheriting this class. I'm inheriting this class. Task create inherited the base model class so that we can have this title string and everything. In this I will have ID which is an integer and is completed which is going to be a boolean. How many of you are clear with this thing what I have done in front of you? How many of you are clear? How many of you are clear with this? Clear? Anyone has any doubt here? Let me quickly again I'm making it very easy as I said like this is the easiest way of teaching about you this thing. So yeah. Okay. Clear. Uh someone was asking me what is this get app.get get right. So when we make when we want to do this uh data exchange, right? A tell me one thing. Okay, just tell me one thing. Uh see get is when you are just getting something. Okay, how can I make it very easy? Okay, there are multiple ways of exchanging the data, right? Just like there are multiple ways of ordering food from a restaurant. Okay, you could directly say what you want. Okay, or let's say it's a simple restaurant which just gives one thing. You go there, they will just give you that thing. You ask for the food, they will give you the food. Okay? Much like a buffet or something. So there are different different these HTTP get, post, put, delete. These are HTTP methods. Okay, HTTP methods. HTTP is hypertext transfer protocol. A little bit uh basic, but yes, the idea is that okay, just tell me one thing. Okay, just tell me one thing. If I want to add a task here, if I want to add a task here, won't the overall type be different? Won't what I want to do, okay, I will be sending some information here. Yes or no? How many of you understand this thing that if I want to add a task here, I will be sending the task now? So, see to add a task, we need to send a task. Pretty straightforward thing, right? Okay. I hope that is clear. But to get all tasks, okay, we don't need to send anything. We don't need to send anything. I hope that is clear as well. Again, keeping it very simple. I'm not making it complex by choice. Okay. So, that is the whole idea everyone. I want to make sure that I am able to do uh I can just let's say when I get all task I will be saying app.t get when I want to add a task I can do it by app.post post that is just the idea nothing else that is why these things exist. So for different see get is used to request data from specified resource nothing else just get the data post is used to send the data to a server or create or update a resource just that is the difference nothing else. So get you are getting something post you are posting something. Okay, clear everyone? Yes or no? Again, very simple, simplest language, nothing difficult. As the name suggests get, okay, you go to LinkedIn, the homepage, you get all the things. But when you want to create a post, you have to add the all the things there, right? Let me just show you that as well. Maybe if my LinkedIn is open. Okay, I think link.in goes to LinkedIn. Yeah, see, as of now, I have just get everything. Okay, I don't have to specify anything at all. I got everything but to post to post I will have to write something. I will have to send some data then it will get posted. Is this idea clear? Is this thing clear now? Simple thing. Similarly, there can be different things as well like if I want to delete a post, I will be sending a delete request. So these are what the methods are. You can see get post, put, delete, patch options just that is the case. Nothing else. I think this should be making it a lot more easy, lot more easier to understand. Okay. So, let us move forward then. Uh let us go and carry it off and let us go on this. So, the very first thing I'm going to create a post request here. Can I create a post request here everyone? If you want to post some job, post some task here. Yes or no? If I want to post some task here, can I create a post request? How many of you agree? How many of you agree on this? Please be a lot active here. Again, I'm keeping it very simple so that each and every one of you are able to understand. And yeah, this is how we will be teaching in our course as well. So, do check it out. Okay, this is the course which I was talking someone is asking and the coupon code is coupon code my uncle let me hide it here so that it doesn't disturb anyone cool so let me do one thing then apppost okay simple I'm going to make sure that uh I first add see here I'm creating an endpoint which is add task So what is an endpoint? This is where you will be hitting if you want to add a task. This is what we call as a endpoint. Make sense? So earlier the endpoint was get items or normal endpoint. I am saying the response. Okay. I am saying the response model. It's going to be a task response. This particular file it's going to be this particular task response. I hope that is also clear. If I want to add a task, I should have this particular thing now which is getting so that is just the case nothing else clear everyone yes or no clear anyone has any doubt again very very easy even if you're completely new I hope that is clear again I'm just giving you a place okay let's say this is the first counter where you can add the task again I'm just all I'm doing is I'm creating a counter so this is my Add task counter. Here you go with your task and it will get added. Nothing else. Does it make sense? Does it make sense? Any doubt anyone let me know quickly what is the response model. In a way I'm saying that this is what will happen when I do this a task response is going to get created and it is going to get returned. So I'm going to return this response model means that see the idea is that uh I can in fast API normally Python is not that kind of a language where you can control what it returns right I hope all of you have a little bit idea about C I will just show you C++ function pay attention C++ functions okay if I show you a function here in C++ it says that what it's going to return it can be void means nothing not returning anything Okay, it can be an integer means it's going to return an integer. Okay, as you can see here, it returns an integer. In Python, if you all are aware, we don't have any such control. If I show you the Python function now, see Python function? We don't have this control. Did I mention what I'm going to return here? Everyone, did I mention it's going to be an integer string? Anything? Yes or no? Did I mention anything? By default, Python doesn't support that. Like there are ways you can force that, but by default, Python doesn't support that. I hope it is clear as well. Right? So that's the whole idea. Nothing else. Now since Python doesn't support this and I am creating a counter, I am creating a counter where I say that okay, hey create a task. You can create a task here and I will be returning you that full task. I will be returning you this task response. I am just specifying that hey I want to make sure that the response my response is following the model of this task response. This is the volt case. Clear everyone now. I hope this is clear. Pretty easy again. Again, if you are going to Burger King, don't fight on me. Key. It has a different thing as well. I will make sure that you get a burger. You don't get a pizza there. Just that is that some thing we have done now. Burger King say you will not be having a veg thali. So I am saying if I create a task response it should return this nothing else. That is the idea. Now does it make sense? Python control better It's better and something which your fast also support let's say normally taking an example simple model response model nothing else now I hope it is clear a lot okay clear everyone yes or Clear great task it just tell me one thing okay just tell me one thing okay let me just do one thing for you all I will explain you using the same thing pay attention see this is my task manager okay let's say eat something initially is this task done or Not initially done over will it be completed or not? Just tell me one thing everyone. I am adding something to my task manager. Do you think that that task will be completed? Yes or no? Do you think that task will be completed? I'm just adding something. It should not be completed. Right? Okay. If I'm adding the second task, if I'm adding the second task, do you think this ID is something which I can control? If you add the second task, I am not saying they go. I just press this enter. It went to two. It didn't ask me. Uh I hope you are able to see the see this small thing or not. One minute. Let me see. Uh are you able to see some uh thing here? a small kind of a rectangle where I'm writing. Are you able to see that? Wait a minute. Sorry. Uh is it online free to do list? Let us do one thing. Uh simple Okay, pay attention everyone. Let's say this is the first time first thing I'm creating. Okay, eat something. This got added as a first task. Okay, this got added as a first task. You clear? Eat something. No due date. It is not completed as of now. Now let's say I add another task. Okay. Now let's say I add another task. So another task can be um enjoy life. Now if I press enter, see this got added. This is also not completed. The whole thing I want to get across is that ID. This ID is also something which we can handle ourselves. We don't need to get from the user. I will not be telling them to my task manager key. This is the first task. This is the second task. The task which I added that is the first task. The next task which I added that is the next task. I hope that is clear now. Clear. Simple. How that uh that was not shown. No worries. Let me [Music] see. Hopefully. Huh. Sorry. My bad. Uh yeah. Now you all will be able to see. So see what I was saying is key first task is eat something. The second I press enter it didn't ask me ID what is the ID. It said that okay the next ID will surely be two. If I say here enjoy life I press it again. Then third ID will be it is by default giving it three and it all of them will be false. They will not be completed. Make sense? This should also makes a lot of sense. Okay. So I'm going to complete this code. Pay attention. I will just press tab and this code will get completed. So it is giving it nicely. See I am saying that okay I will add a task. This task should be of type task create. So again in Python by default you cannot set key whether it will be an integer. Okay whether it will be a string. Okay. But the whole idea is using fast either as well you can do this. Let us say it is using fast API. The idea is I'm setting this thing please send me this task create and this task create will have a title. It will have a description and it will have a owner. Does it make sense now everyone? Yes or no? Uh Vishujit if you think about this is completed as a checkbox. Okay. False to it will not be completed. So pay attention everyone. All I'm saying is key first I get I will be sending it as a dictionary. See I will be sending something like this. Pay attention. I will be sending title. Let's say eat something. Okay this is the title which I'm going to send. Then I will be sending a description which okay let's say this is something like this. Okay my uncle eat something. Okay please eat. I will be set sending these things to my list. Okay. All I'm doing is first I'm checking key how many items are there in my list. So see length of items plus one which I think is a fabulous logic. Right? Initially it was one only because it was empty. Then it can be let's say if I do eat something then it will be two. Okay. Let's say enjoy life. Next it is going to be three. So how many items I have plus one is the total number of items and this is what I get. Clear everyone? Is it clear? Yes or no? Is this thing clear? Anyone has any doubt in this? Why task do? Because I will be sending it like this. So normally what happen is that when you send your post request to J to a API you send it in a JSON. So this is a JSON or a dictionary. So again they idea you cannot give American dollars to Burger King in India right? They will just be accepting Indian rupees. Same goes for the other way around. So on the internet we are set in a proper way. You are sending a list. You are sending a simple text. Someone is like I will send description first. That is the whole idea. Nothing else. Okay. And this is false by default because my work will not be completed. We just discussed that. By default our work will not be completed. Make sense everyone? Clear? Simple. I'm making it very very simple. By simple answer your big data courses Udemy is very easy. Super. Thank you Arin. Uh I'm creating more courses. Don't worry. Okay. What is the difference in uh boot camp course and complete ML course on Udemy? Uh Ranija the major difference is that these will be live these will be having hackathon, community support, multiple mentors. We will be teaching these things a lot like in this particular course we will be teaching you things which are required directly for AI kind of a work. Right? So that is the major difference. Concept wise also we will be covering it in a better way. That's the thing. Where is task DB declared? It is declared here. Task DB. Okay, cool. I'm making another one. App do.get. Okay. And I'm doing get task. But okay, let me do this. I think it is it is understandable easily. See if I want to get all task. Can I make a just a task db here? Simple. I will create one more. App do.get. It's pretty good the autocomplete get task but I will get the task by user. Okay. So by owner I will be getting the task. This time I want they some task may has given some task you all will be giving. So if I want just my task I can do owner only. Okay. And pay attention this time what I'm doing I am saying that for each and every task for each and every task in this task DB if the owner is Mayang if the owner is whatever owner I send here just return that task okay we are just returning the first task that should not be a problem okay hello sir why don't you import py import I've already imported Okay, clear everyone. I hope this

Original Description

Live Session: Build RESTful APIs with FastAPI in Python 🚀 I’ll be going live today, March 18th at 8 PM IST to walk you through FastAPI, one of the fastest and most efficient frameworks for building RESTful APIs in Python. Join the free course https://learn.krishnaikacademy.com/l/e88133de52 In this session, we’ll cover: ✅ Why FastAPI is a game-changer for API development ✅ How to build high-performance, scalable APIs ✅ Hands-on implementation with real-world examples ✅ Best practices for deployment This session is also a lead-up to the Ultimate Data Science and Basic GenAI Bootcamp, an 8-month live training program covering Data Science, Machine Learning, and Generative AI. Enrollment Link: https://www.krishnaik.in/data-science-course Bootcamp Details: 📅 Start Date: March 22, 2025 (Sat & Sun, 8 PM - 12 AM IST) 👨‍🏫 Mentors: Sourangshu Paul, Mayank Aggarwal, Krish, Darius & Sunny 🔗 Syllabus: https://bit.ly/4jG8rgQ The program includes hands-on projects, real-world case studies, hackathons, job referrals (if available), resume discussions, and mock interviews. 📞 For any queries, reach out to Krish Naik's team at +91 9111533440 Set a reminder and join me live! Looking forward to an interactive session.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Krish Naik · Krish Naik · 0 of 60

← Previous Next →
1 Natural Language Processing|Stemming
Natural Language Processing|Stemming
Krish Naik
2 Natural Language Processing|BagofWords
Natural Language Processing|BagofWords
Krish Naik
3 Gaussian distribution or Normal Distribution in statisctics
Gaussian distribution or Normal Distribution in statisctics
Krish Naik
4 Natural Language Processing|TF-IDF for Machine Learning| Text Prerocessing
Natural Language Processing|TF-IDF for Machine Learning| Text Prerocessing
Krish Naik
5 Log Normal Distribution in Statistics
Log Normal Distribution in Statistics
Krish Naik
6 Covariance in Statistics
Covariance in Statistics
Krish Naik
7 Confusion matrix, Precision, Recall| Data Science Interview questions
Confusion matrix, Precision, Recall| Data Science Interview questions
Krish Naik
8 Tutorial 44-Balanced vs Imbalanced Dataset and how to handle Imbalanced Dataset
Tutorial 44-Balanced vs Imbalanced Dataset and how to handle Imbalanced Dataset
Krish Naik
9 Implementing a Spam classifier in python| Natural Language Processing
Implementing a Spam classifier in python| Natural Language Processing
Krish Naik
10 Tutorial 11-Exploratory Data Analysis(EDA) of Titanic dataset
Tutorial 11-Exploratory Data Analysis(EDA) of Titanic dataset
Krish Naik
11 Face Recognition using open CV and VGG 16 Transfer Learning
Face Recognition using open CV and VGG 16 Transfer Learning
Krish Naik
12 Pedestrian Detection using OpenCV from Videos
Pedestrian Detection using OpenCV from Videos
Krish Naik
13 Face and Eye Detection from Videos using HAAR Cascade Classifier
Face and Eye Detection from Videos using HAAR Cascade Classifier
Krish Naik
14 Reading, Writing and Displaying images with Opencv| OpenCV Tutorial
Reading, Writing and Displaying images with Opencv| OpenCV Tutorial
Krish Naik
15 OpenCV Installation | OpenCV tutorial
OpenCV Installation | OpenCV tutorial
Krish Naik
16 Face and Eye Detection from Images using HAAR Cascade Classifier
Face and Eye Detection from Images using HAAR Cascade Classifier
Krish Naik
17 Car Detection using HAAR Cascade and Opencv from Videos.
Car Detection using HAAR Cascade and Opencv from Videos.
Krish Naik
18 Using OpenFace for Face recognition in Keras
Using OpenFace for Face recognition in Keras
Krish Naik
19 OpenPose Tutorial with Tensorflow
OpenPose Tutorial with Tensorflow
Krish Naik
20 Multiple Linear Regression using python and sklearn
Multiple Linear Regression using python and sklearn
Krish Naik
21 Dimensional Reduction| Principal Component Analysis
Dimensional Reduction| Principal Component Analysis
Krish Naik
22 Movie Recommender System using Python
Movie Recommender System using Python
Krish Naik
23 TPR,FPR,FNR,TNR, Confusion Matrix
TPR,FPR,FNR,TNR, Confusion Matrix
Krish Naik
24 Precision, Recall and F1-Score
Precision, Recall and F1-Score
Krish Naik
25 Artificial Neural Network for Customer's Exit Prediction from Bank
Artificial Neural Network for Customer's Exit Prediction from Bank
Krish Naik
26 GridSearchCV- Select the best hyperparameter for any Classification Model
GridSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
27 RandomizedSearchCV- Select the best hyperparameter for any Classification Model
RandomizedSearchCV- Select the best hyperparameter for any Classification Model
Krish Naik
28 K Nearest Neighbor classification with Intuition and practical solution
K Nearest Neighbor classification with Intuition and practical solution
Krish Naik
29 K Means Clustering Intuition
K Means Clustering Intuition
Krish Naik
30 Create custom Alexa Skill- Lambda function- Part2
Create custom Alexa Skill- Lambda function- Part2
Krish Naik
31 Hierarchical Clustering intuition
Hierarchical Clustering intuition
Krish Naik
32 Implement Transfer Learning with a generic Code Template
Implement Transfer Learning with a generic Code Template
Krish Naik
33 Gender Classifier and Age Estimator using Resnet Convolution Neural Network
Gender Classifier and Age Estimator using Resnet Convolution Neural Network
Krish Naik
34 Unlock Your Application With Your Face using OpenCV
Unlock Your Application With Your Face using OpenCV
Krish Naik
35 Draw rectangle from webcam and sketch process it on a live feed
Draw rectangle from webcam and sketch process it on a live feed
Krish Naik
36 Complete Life Cycle of a Data Science Project
Complete Life Cycle of a Data Science Project
Krish Naik
37 How we can apply Machine Learning in Finance
How we can apply Machine Learning in Finance
Krish Naik
38 Deep Learning in Medical Science
Deep Learning in Medical Science
Krish Naik
39 How to switch your career to Data Science.
How to switch your career to Data Science.
Krish Naik
40 Linear Regression Mathematical Intuition
Linear Regression Mathematical Intuition
Krish Naik
41 Handle Categorical features using Python
Handle Categorical features using Python
Krish Naik
42 Machine Learning Algorithm- Which one to choose for your Problem?
Machine Learning Algorithm- Which one to choose for your Problem?
Krish Naik
43 DBSCAN Clustering Easily Explained with Implementation
DBSCAN Clustering Easily Explained with Implementation
Krish Naik
44 Curse of Dimensionality Easily explained| Machine Learning
Curse of Dimensionality Easily explained| Machine Learning
Krish Naik
45 Feature Selection Techniques Easily Explained | Machine Learning
Feature Selection Techniques Easily Explained | Machine Learning
Krish Naik
46 Tutorial 29-R square and Adjusted R square Clearly Explained| Machine Learning
Tutorial 29-R square and Adjusted R square Clearly Explained| Machine Learning
Krish Naik
47 Cross Validation using sklearn and python | Machine Learning
Cross Validation using sklearn and python | Machine Learning
Krish Naik
48 Handling Missing Data Easily Explained| Machine Learning
Handling Missing Data Easily Explained| Machine Learning
Krish Naik
49 Deploy Machine Learning Model using Flask
Deploy Machine Learning Model using Flask
Krish Naik
50 Deployment of Deep Learning Model using Flask
Deployment of Deep Learning Model using Flask
Krish Naik
51 How to Visualize Multiple Linear Regression in python
How to Visualize Multiple Linear Regression in python
Krish Naik
52 K Nearest Neighbour Easily Explained with Implementation
K Nearest Neighbour Easily Explained with Implementation
Krish Naik
53 Predicting Heart Disease using Machine Learning
Predicting Heart Disease using Machine Learning
Krish Naik
54 Predicting Lungs Disease using Deep Learning
Predicting Lungs Disease using Deep Learning
Krish Naik
55 Stock Sentiment Analysis using News Headlines
Stock Sentiment Analysis using News Headlines
Krish Naik
56 Random Forest(Bootstrap Aggregation) Easily Explained
Random Forest(Bootstrap Aggregation) Easily Explained
Krish Naik
57 Voting Classifier(Hard Voting and Soft Voting Classifier)
Voting Classifier(Hard Voting and Soft Voting Classifier)
Krish Naik
58 Credit Card Fraud Detection using Machine Learning from Kaggle
Credit Card Fraud Detection using Machine Learning from Kaggle
Krish Naik
59 Hyperparameter Optimization for Xgboost
Hyperparameter Optimization for Xgboost
Krish Naik
60 Tutorial 45-Handling imbalanced Dataset  using python- Part 1
Tutorial 45-Handling imbalanced Dataset using python- Part 1
Krish Naik

Related AI Lessons

Up next
This Cop Was Held Accountable For His Brutality! #police #lawyer
Hampton Law
Watch →