How to Deploy Machine Learning Model as an API in Python - FastAPI

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone i am siddharthan in this video we will be discussing how we can deploy a machine learning model as an api in python and for creating this api we will be using the python library called fast in our previous video we have seen how we can deploy machine learning models uh using streamlit right but the disadvantage of using libraries like streamlet or flask is that they are more of a prototyping tool so we won't be getting that much detailed ui and it is not like that much flexible as well so the most widely used method is to deploy this machine learning model in the form of apa and then integrating this api with our ui system okay so we you know let's say we are creating our user interface using tools like react js and once we create that ui we will integrate this api to this okay so when we say apa we finally get a url and we will post this url to that ui system and now this will be a working system where your uh frontend which is your ui will be connected to your backend which is basically the api we are creating in python okay and i hope you know that the uh full form of this api is application programming interface okay and the first step for this is to save the model that we have trained so i'll open my google collaboratory so for this we will be using the same diabetes prediction model that we have already worked on so i have already posted a video on how we can build this diabetes prediction machine learning model and i'll give the link for that video in this video description if you want you can check that out okay so in order to save this model just uh you know i'll give the link for this collab notebook as well so connect your system so once it's uh you know connected we have to upload this data set file which is diabetes.csv so i have did all these coding parts so i'm not explaining uh you know what we are doing in these tips so if you want a detailed explanation of all these steps please watch this diabetes prediction video and now i'll go to my files and i'll upload this dataset file so this dataset file is in my desktop which is diabetes.csv okay so these are the basic step of importing the libraries and and import like importing the data set into this uh data frame and so on so after that we are training this machine learning model using support vector classifier model uh svc and after that we are like predicting what is its accuracy score so the accuracy score is like 78 percentage and 77 percentage so this is for training term test data this is uh the code for predictive system which we have like already discussed okay and finally we are importing this pickle library so we are going to save our model as diabetes underscore model dot scav so this is the file in which we are saving a trained model as you can see here so once we save this it will so we can like find this model here okay so let's run all these cells so this dataset file has been uploaded i'll also give the link for this data set file as well so once you have uploaded this make sure your system is connected and go to this runtime and click run all so this will run all the cells uh so this won't take like that much time okay yeah it has completed uh running now so this until this part like we are predicting the accuracy score so this is like the predictive system which we have discussed already now this is this part is for saving our trained model so we are creating a file name which is diabetes underscore model dot sav and we are creating this file using this right uh you know function and then we have like saved it so once you run this particular cell you will uh get this file which is diabetes underscore model dot sav and we will save this model and we will be using this model file for deploying you know as an api so this is the model which we will deploy as api and these are like the steps i mean we don't need this but what we are actually doing here is we are loading this same uh saved file here and we are again doing this predictive system so this two cells are not like that much necessary and finally i'm just printing what are all the columns that are present in this data set okay so we have loaded this diabetes dot csv rate so these are all the columns that are present there so we have like the number of pregnancies glucose level blood pressure value skin thickness insulin bmi diabetes pedigree functional h so these are all the input parameters that we have and apart from this there will be this outcome column which we won't mean because that's what we are going to predict right so you can see this uh data frame here so it has like all these values and we have this outcome so this will be our final thing so we don't have to include this okay so we need from this pregnancy to the ch which i have like printed in this last step now let's see how we can deploy this as an api let's download this saved model go to this files and i'll go to this option and download this model so this is what we are going to use now so this will be in your downloads so you can see it here so this is in my downloads folder yeah so you can see this now so i'll open my anaconda navigator and i've already opened my spider so you have to do this as well and we need like certain libraries for this okay so the libraries that you need are uh fast apa uv con pedantic json pickle scikit-learn and requests so these are all the libraries that we need so if you haven't like uh install these libraries and anaconda please download these libraries so these are all the commands for uh installing these libraries so pip install fast ap and then we have this pip install uv on pixel 5 identic etc okay so how you have to install this is go to your anaconda navigator and uh this is the environment that i am running so in case you have not created a new environment just choose base root itself so go to your environment environments and choose which environment you are using and in this uh you will find this play symbol click that and open this terminal okay so this is where you have to paste these commands so if you want to install this fast api just copy this and paste it in this terminal okay so once you press enter this library will be installed so i have already installed this library so for me it would say that the requirement already satisfied okay so do this for all the libraries that we have okay so that is like uh the first uh thing that you need to do so like install all these libraries so just pass this video and install all these libraries before you know continuing with the other steps so then only it will work so i'll close this now so once you have installed all these libraries open your spider okay so now the other thing that you need to do is create a folder so in my desktop i have created a folder as embl model as apa so you can create this anywhere it's not that you have to create only in desktops i have created this uh in my you know desktop which is named as ml model as ap and i have created another folder as python code again you can create like give any folder name and within this i have pasted my diabetes underscore model.sav so this is the same file that we have downloaded from our collaboratory okay so once you have downloaded that file uh you know copy that file from your downloads and paste it in this particular folder which you can name as python code or anything else so this is where we have to create our python files in spider so i'll go to my spider so i'll you know go to file and give this save and i'm going to save this in desktop ml model as apa python code okay and i'll name this as name this particular file as ml underscore apa which implies that we are going to deploy this ml model as an ap so make sure like that you use this underscore and not give any space between these words and press enter so now we have created this file and this is where we will be creating this api using a fast api library um so the first thing is i'll import from fast apa input past api so this ef and this api should be in caps and after that let's import from identic input yeah this model is the second thing that we have to install okay so from pidentic import base model then let's import pickle so i'll explain you what is the purpose of all these libraries after completing this so import pickle and finally let's import json library so import json okay so this fast api as i have told you uh it is used for creating this apis in python and from this pydantic library we are installing this base model so the purpose of this base model is we have to mention like what are all the formats of input that our model is going to need so if you don't understand like what i said no it's okay so you will understand once we are like using this base model and after that we are importing the speaker library which is used to load our saved model so if you remember we have saved our model using pickle and we again need this in order to load our model finally we need json i'll also explain why this json module is again used and now i'll create a variable and name this as app so this app is equal to fast api again this ef and api should be in caps which we have imported here okay so we are loading this instance of fast api to this variable code as app now i'm going to create a class as model input okay so model uh input and within this we have to mention base model so this base model is what we have imported from pidantic library and this is why we need this uh pidentic library as well just a second yeah okay so i'll give a column here now we have to mention what are all the input parameters that are modelling so those are nothing but this pregnancies glucose uh blood pressure skin thickness insulin bmi diabetes pedigree function and dh okay so these are all the things that we need so let's copy all these things and paste it in this spider okay okay so first is this pregnancies pregnancies mention a colon and we have to mention what is the data type that it takes so if you just go here you can see uh pregnancies glucose blood pressure all the way up to this insulin are integer values this bmi and diabetes pedigree function so these two alone are floating point values that mean decimal values okay so we have to mention that so apart from this bma and diabetes pedigree function all are integers so i'll just scroll here so we have this pregnancies and after this pregnancies i will mention this as int okay so this uh parenthesis should not be there so delete it okay so let's delete after like completing this the second one is blue pose so i'll write glucose here and this should also be an integer value later we have this blood pressure okay so i'll copy this blood pressure here and this also should be an integer value and the next one is skin thickness again skin thickness is an integer value and then we have insulin bmi and diabetes pedigree function finally we have the ch so i'll copy this diabetes pedigree function and finally eh now we have to mention their data types as well okay so so i'll give a column here and let's say this is in so bma should be a floating point value so i'll mention this as float and diabetes pedigree function is also a float which we have seen there so i'll mention this one as float and age should be an integer okay yeah so now let's remove all this parentheses so it should not be present there so these are all the parameters or the input you know features that we will pass to our model and we have to mention what is its data type so this one is like necessary so pregnancies glucose blood pressure skin thickness and insulin so these are integers along with this age whereas this bmi and diabetes pedigree function so these two things alone are floating point values okay so now i'll just minimize this one so this is just telling the api that this is the format of data that i'm expecting so totally i think there are like uh eight values so one two three four five six seven eight so there are like eight values and out of this eight values two are floating points so this is for the api to know that this is the format of data that i need now let's say load the saved model loading uh the saved model and for this let's call this model as diabetes model and this diabetes model is equal to pickle dot load and within this we have to say open this diabetes model dot sav so uh go to the folder in which you are like saving this python file so this is the folder where i have created this ml underscore apa and we have this model file saved here right so copy the name of this file paste it within this quotes and after this we have to say rb that means we are reading this file uh in bytes okay so this step is very important the reason we are putting this model file in the same directory of this python file is that we don't have to mention any directory so if it if this file and this python file are in the same directory so that's the reason we need to save this in the same directory and so this will load this diabetesmodel.sav to this variable called as diabetes model okay and after this we can create our apa so the first step is importing the required libraries and uh loading this instance of fast api then mentioning what is the input format that we need and after that we are loading the model now we can uh create our api okay so here we have to say at app.post so there are like two main uh methods for ap so there are like other methods as well but the most widely used methods are app.get so this is what we call as get method and the other one is app.post so we use this post method when someone has to give some values to our api in this case the values that our ap need are these things so in other words these values will be posted to our apa and that's why we are using this post method okay so app.post so if you don't understand much about this apa and fast ap and all those things don't worry i'll create a series of videos on how to create this fast apis basics of api and so on but for now let's discuss how this can be implemented in machine learning's perspective okay so at app.post and within this we have to mention in point so in point is like what is the ending of your url so here mention a forward slash and let's say this is diabetes prediction so you can give any name here but you have to use the same name later uh what you're giving here so here i'll use this diabetes underscore prediction now we have to create a function so def which means define diabetes again you can give any name here so input parameters input parameters give a colon and here we have to mention what we have mentioned here the class that we have created so i'll paste this here model input okay so this means like uh this input parameters is the one which the user will be sending to this apa so after this we can say this input data is equal to input parameters dot json okay so i'll explain you what we are doing here and finally we have this input dictionary so this input dictionary is equal to json.loads so this is not load this is load so we we should have that yes there and here let's say input data okay so let's try to understand what we are doing in this uh case okay so this should be equal to okay so uh we have mentioned the format in which our ap need the data so this is the data that will be posted to our api with the input diabetes underscore prediction okay so this is called as the end point and we are creating a function and mentioning the input parameters the values that the user will give are the format model underscore input which is this pregnancy is glucose all the way up to age okay now this data will be posted to our api in the form of json okay and we have to convert this json to a dictionary so that is what we are doing here so we will finally get a url while we you know deploy this apa and to this api uh they will force these values the user will post these values which will be in the form of json so once you receive this json you have to convert this to a dictionary so that's what we are doing here so input data is equal to input parameter.json and when we say this json.loads this will be converted to a dictionary which will be stored in this input underscore dictionary okay so this is the final dictionary that we are creating which will contain all these values that we have to predict say for example uh let's say these are all the values that the person is giving so 5 represents the pregnancies and you have the glucose number and so on so these are all the eight input parameters that we need so this 25.8 is my bmi and 0.587 is my diabetes pedigree function so all these values will be posted to our apa and we are converting all these values which is in the form of json into a dictionary okay now we have to convert this dictionary into a list or tuple like this so let's see how we can convert this dictionary to a list so i'll create a variable called as preg which stands for pregnancies and then mention input dictionary so input dictionary and within this we have to say pregnancies so let me just copy all these things first the first we have this pregnancy so the next thing is glucose as you can see here so let's you know do this the eight times as we have like eight input features six seven and eight so the second parameter is glucose so let me name this as glu which stands for glucose and third one is uh blood pressure so let me put this as bp and then we have the skin thickness let us call this a skin and next one is insulin so i'll name this to insulin itself and then we have this bmi so i'll uh type bmi with lowercase letters again you can use any variable names for names here and let's call this diabetes pedigree function as dpf and finally we have eh so let me call this as h now within the squares we have to mention all these things first is pregnancy later we have this glucose and the next one is blood pressure and then skin thickness the next one is insulin last before is diabetes pedigree function and here we have this bmi and finally we have this age so what you mentioned here within this course should be the same thing as what we have mentioned here okay so this is very important and for this you can create any variable names in this place so we have this pregnancies glucose bp all the things here so what we are trying to do is so we are like extracting all these values individually so this is the dictionary that we have created and when i said input dictionary of pregnancy so all these things act as my key and i want to like store all the values for these keys in this variables so this may sound a bit complicated but this is the simple concept of dictionary so we know that dictionary is a key value pair right so all these things pregnancies glucose and repressor values represents our keys and these are our values so we will like pass these values later on but this is what we call as values so when we you know implement this part of the code this will load all these values let's say this 5 166 all these things to these variables now we have to pass these these values to our model for prediction let's see how we can do that so this should be inside this uh diabetes spread function okay so i'll press tab now let's create this input list so this is the final data that we will be passing to our model so input data is equal to brick uh so we just have to mention all these variables so trig which stands for pregnancies and then we have this glucose bp skin thickness insulin [Music] dpf which is diabetes pedigree function and finally eh okay so one two three four five six seven eight okay so totally there are like eight input features which we have here so once we extract all this information from this dictionary we are storing all these values to individual variables and later we are combining all these values to a list now we can pass this list to our model that we have loaded here to this diabetes underscore model and we can make this prediction okay so now let me say prediction is equal to diabetes model dot predict input list okay later uh let's say if this prediction so the final result will be either one or zero so if the value is 1 that means the person is diabetic if the value is 0 that means the person is not diabetic so i think yeah so here we have mentioned so 0 means non-diabetic one means diabetic so we have to mention this here if this final prediction the final prediction of zero is equal to 0 in that case we have to say return so this is a function so so we have to return some of this the person is not diabetic because the value is zero here okay this is not diabetic whereas else condition else means the value will be one else we have to return so here we are returning string values the person is diabetic okay so this is also now once we run this our ap will be ready so let's try to understand what we are doing here so this is the same as we done in this like uh prediction code so we have built this uh predictive system right so we are like doing the same thing but in a different format so we are like taking the input data reshaping this and finally we are like uh using this predict function and passing this input data right and checking if this value is 0 we say the person is not diabetic if the value is 1 we have to say diabetic so this well this prediction will be a form of list and in order to capture the first value we are mentioning this index is zero so this is not like that much complex so i hope you understand this part so if not please watch that diabetes prediction video where i have explained this or detailing so if this final prediction is zero we have to say first is diabetic if not we have to say the person is diabetic that means in this case the label is one so here the main thing that you have to note here is this is a list and while predicting we have to enclose this list within a list so that's why i have used a square bracket here see so there is an opening square bracket here and ending square bracket here yeah so this is the one so this list should be enclosed within our list so the reason is if we don't do that we have to reshape this using this uh numpy library using this one comma minus one and so on so this is for the model to tell that i'm trying to predict for only one data point so that's the purpose for this okay so instead of doing this reshape and all those things we can just put this list within a list so that is like a shorter way of doing this so let's try to understand what we have done in this entire part of the code so first we are like importing these four libraries fast api is used for creating these api apps and pedantic from this financing we are importing base model and the purpose of this base model is to set up the format in which the data will be posted to our api and then we have this pickle for uh we know that to load the saved model and then we have json so i have explained you why this json is used it is used to convert this json object into a dictionary in python okay so then we are creating a class called as model input where we are mentioning the format in which the data will be given to our model and then we are loading the model using this pickle dot load and later we are uh creating a function called as dive display and before that we are like creating this post method with the endpoint diabetes underscore prediction okay and we are telling that the input parameters will be in the format of model input which is given here okay so this is my input values and now i have to convert this input values which is in the form of json into a dictionary which we are doing here okay later we are like extracting all the values from this dictionary and converting it to a list in this step and later we are using this model.predict function in order to predict whether the label is zero or one so i'll save this file now you cannot run it here so if you run this here your api won't work so for this what we have to do is so go to your anaconda navigator and go to your environment okay so machine learning is the environment where i'm where i will open opened my spider and where i have installed the library and so on so i have to go to this play symbol and open my terminal and here once this terminal has been opened so you can see the environment name which is uh machine learning okay and we have this the path of my users and my name now we have to say cd space double quotes okay so once it now within this double quotes uh we have to mention the path of the file in which my python file is stored so this is the file right this ml underscore ap so this file is located in this path so i'll open this folder and if i you know click here i will get the path so i will copy this path paste it here so the command should be cd space double quotes and within this you can paste the path and again close it with double quotes now this will direct you to that particular directory okay so this is now in desktop and ml model as apa and python code which is my directory now we can deploy our apa so i have to say uv con and here we have to mention the name of the python file that we have created which is ml underscore apa right so you can also see this in spider okay so after this uv con command i should uh say ml underscore apa so this up this uv cone command won't work if you don't install this uv con library and i have showed you uh you can install this new week on using pip install uv so make sure that you have installed all this library before you know running all these steps so i am in this folder so i'm mentioning ml.ml underscore ap mention the colon and and mention app okay so it should be uv con name of the python file that you have created on and app so this app is nothing but what we have created here so we have loaded our fast api instance through this variable cordless app right so that is what i am mentioning here okay so you become name of the python file which is ml underscore app sorry ml underscore ap call an app so after this press enter so now this will give you your localhost url in which your fast api is being deployed okay so i'll press enter so it might take like three or four seconds in order to give us the details just wait for few seconds yeah so this is uh the port or the local host url in which my ap is running okay now we can test our api so like you can give this localhost url to this ui that you are building in let's say react.js so once you give this to this localhost url and post the values you will get the prediction of whether the person is uh you know diabetic or not so for now let's not you know go to that ui part let's test whether this ap is working or not so for this we can also check this apa so we can also test the cp in python itself so i'll come to my spider and uh i'll create a new file and now in this new file let's see whether uh this api is working well or not so here i'll import the library json and uh i'll also import a library called as requests so this request is used to you know get our post values to our ap and now i'll say url so url is equal to so within this we have to paste this localhost url which we have you know got here which is http uh 127 in the port 8000 so i'll copy this paste it here and we should also mention the endpoint so put a forward slash here and copy the endpoint that we have created which is diabetes underscore prediction okay so diabetes underscore prediction now so let's pass the input values so i'll create a dictionary as input data or model okay so this is a dictionary which we can create using curly brackets so let's give the values so the values should be so these should be the same names as we have here pregnancies locus blood pressure all these values so i'll copy all these things paste it here and now we can remove all this int and all those things so this is where we have to give the real values so i will remove all this in so this is basically a dictionary that we are creating float diabetes pedigree function finally eh now all these values should be enclosed in quotes either single quotes or double quotes i'll enclose this within single quotes so this will be the key for my dictionary so blood pressure skin thickness insulin bmi diabetes pedigree function ph okay so now we can pass the values so i'll save this file as apa implementation so apa underscore implementation okay so the idea is i have to post all these values so i have to post all these values to this url and it will tell me whether the person is diabetic or not okay so this is the final result that we are interested in okay so now let's give some values to this so i'll open my diabetes.csv file so let's test for a person with diabetes and person without diabetes okay so let's check this first data point which is 6 148 and so on and the second data point once we give all these values it the outcome should be 1 that means it should say the person is diabetic right so let's paste all these values so for pregnancies so pregnancies the value is 6 6 and for glucose we can see the value is 148 so just see this first line and we can like put all the values here so glucose is a 148 and blood pressure is 72 skin thickness is 35 insulin the value is given as 0 and bmi is given as 33.6 and pedigree function so diabetes pedigree function is given as 0.627 and finally we have this eh so age value should be 50 as given here okay so this is the data that i'm passing and it's showing a error here because all these should be separated by comma okay 72 comma 35 0 33.6 and finally 0.627 so this is the dictionary that we have created now we have to post this dictionary to this url okay so these are my keys which are you know enclosed here and the values for this key is this for the value for this key pregnancies is 6 and the value for the key glucose is 148 and so on so this is what we are extracting in this particular step okay so i'm mentioning this input dictionary which is nothing but this input data from for model so it changes p to o model okay so we are like extracting all these values individually in this particular step and then we are like using it to predict it okay so let me go here now as i have told you earlier this is in the form of a dictionary now the next step that we have to do is convert this dictionary in the form of json so that's why we have imported this json library here and for this i can say input json so this is the json object that we will passing or posting to our ap so input json is equal to json dot dumps again this is not dump this is dumps so here we have to mention input data for model okay and finally we can say this the response is equal to request dot post and within this we have to mention this url comma data is equal to input json so this final response will be stored in this variable called as response and we can print this response dot text so it will only print the value if you give this as text because finally we are giving or we are returning the values in the form of a string which is text okay so save this one now we know that this data point refers to a person who has diabetes the outcome is one so the final result we should get once we run this cell is the person is diabetic right so we have to get this particular string so let's see whether this api is working so this is api that we have created and this is the end point for the ap that we have created in this particular file okay so here what we are doing is first importing json and request so json is used to convert this dictionary into a json object which we are doing here and later we are using this request in order to mention this url and post this data to our url okay so this should be the same as we have mentioned here because this is the format right so we have to pass the values in the same format so i'll save this and let's run this one okay now it says the person is diabetic because it is the outcome is one now what we are doing is this ap is running so it is running in this particular port so you can say so 200 okay so 200 means in in http request 200 means uh the input value is working and and everything is working properly so you may also get like uh internal server error and other things so if there are some errors in your code let's say that there is some error that you have made in this particular api file so those errors will be mentioned in this terminal okay so you won't see it here but it will be mentioned here so that is other thing that you can remember and now we have created this and deploy this ap in localhost and we have mentioned this endpoint now it can predict whether a person is a diabetic or not so you don't have to train your model each time and like once you can save your model and you can deploy this in the form of ap now let's check for a person without diabetes as well here let's check the second values so here i'll change this to 1 and now let's change this to 85 which is given here so the glucose value should be 85 and then we have the blood pressure value as 66 skin thickness value should be 29 insulin values again 0 bmi is 22.26.6 you have 26.6 and a diabetes pedigree function is 0.351 351 and finally the age is 31. okay so here the outcome is 0 as it's mentioned here now the model should say that the person is not diabetic okay so we'll save this and run this one okay so it says the person is dot not diabetic so instead of telling this in string you can also like return this 0 or 1 in this case so in this case you can return 0 or in this case you can written one so how all these things comes together is so once we deploy this in a url so we will uh you know paste this url in our ui and uh from there the ui person will post this data uh which is probably entered by the user and this data will be posted back to our ui where in the back end we can like uh pose this to our apa and tell whether the person is diabetic or not so this is how all these things comes into play so this is just for testing purpose but this is what we are interested in so this is the file that we are interested in so instead of checking this in this python file itself so this will be integrated in a ui so in this case this is a localhost url and this will run only in your system okay so this is not a public url yet and in the next video i'll show you how you can deploy this api as a public url public url of public ap is the one where if you like deploy this api anyone can access it anyone can check its results so that is what i mean when i say public i'll show you how we can do that on collaboratory google collaboratory and in the upcoming video i'll also show you how we can uh deploy this api on eroku where it will be a permanent link okay so those will be the topics that we'll be covering in the upcoming videos and before like ending this i'll just give you a quick recap of what or the things that we have done here so this may seem a bit confusing to you as you might not have experienced working with this api and fast api and things like that uh but like once you start practicing practicing it it is like much easier okay and apas are not only used for deploying this machine learning model so there are like a lot of other applications for this api as well and it is like a great skill to have to build apas okay so i'll just give you a quick recap as stored so first we are like saving this diabetes model which we have trained using this diabetes.csb and we have saved this using this pickle library so we have like dumped all the you know parameters to this diabetes underscore model.sav which we have downloaded from here right and later i have created a folder called as uh the ml model as apa in my desktop and there i have created a folder called as python code and this is where i'm like saving my python file and my model so this should be in the same directory this diabetes model dot sav and mlap my python file should be in the same directory and before uh writing all those codes you have to mention like you have to install all these libraries and this is the command for it okay so pip install fast api you be configure five pi identical ci kit learn request and i you know pyp a json so this is for installing the json library so make sure you run uh or you install all these libraries uh from the command from the terminal which i have shown you so after that we can come to our spider where we are importing all the required libraries loading the fast api instance to this variable called as app later we are mentioning what is the input parameter so we have this pregnancies glucose all the eight parameters as we have seen in this collaboratory file itself okay so to save this file just uh i'll give you the link go to this runtime so go to this runtime and we have to click run all and before that you have to upload this dataset file so after uploading this data set file only you have to run all these cells okay so then we are like loading the saved model which should be in the same directory as this ml underscore ap file and then we are creating this post method for our ap with this endpoint okay and then we are like extracting all this data so first we are converting this json file in our json object into a dictionary and later we are like passing all these values to our model for prediction and when the label is 0 it should say the person is not diabetic when the label is one it should say the person is diabetic so that's what we have done in this if condition and we have tested this api in python itself by uh mentioning this url which is my localhost port that we are getting from this terminal okay and later uh like we are converting this dictionary into a json object which we are posting here and we can like print this response dot text which will give you the final result as whether the person is diabetic or not as i told you in the next video let's try to understand how we can create this public apa and in the uh video after that we will also be uh you know understanding the deployment in europo or other platforms okay so i hope you have understood all the things covered in this video and if you wanted to stop this deployment in this local host come to this terminal press ctrl c so if it's not working the first time just press ctrl c again and it will shut down your system now your apa won't be working now if i you know ah run the cell it it won't be giving uh it probably will give me an error because this api is not running as you can see so the connection error is there now if i go here open this terminal again i can say this if you remember we have to mention the directory of this python file and later we have to say uv call and uh ml underscore apa and colon app now press enter again this will run and now you can uh run this file to check its implementation so this port won't change when you run in low colors so you will get the value for this the label for this particular values which is the person is not diabetic okay so i will close this uh deployment now by pressing control plus c so it will shut down the system okay so this is how all these things work i hope you have understood all the things covered so like if you skipped a few parts of the media you might miss few things and you might get an error so please watch the video completely practice this by yourself and see how all these things comes together okay and i promise you this will be a very helpful for you in several cases okay so that's it from my side and uh i'll give the link for all these python files and the collab collaboratory file as well so yeah i'll see in the next upload thanks for watching
Info
Channel: Siddhardhan
Views: 40,011
Rating: undefined out of 5
Keywords: Deploy ML model as API in Python, Deploy ML model as API, Deploy Machine Learning model as an API, ML model as FastAPI, Deploy ML model using FastAPI, FastAPI for Machine Learning model, ML model deployment, FastAPI in Python for Machine Learning, Machine Learning Course, Machine Learning Training, Machine Learning Tutorial
Id: ZTz26f6XXrQ
Channel Id: undefined
Length: 43min 24sec (2604 seconds)
Published: Mon Jun 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.