For a Normal Machine learning Developers it is easy to develop API for there Machine learning model , what if they need to complete the task with UI to test there api's.
They can create api with the help of Flask Service,which is super easy and light weight but we can test only via POSTMAN.
In this post i am going to say about FASTAPI,with this framework we can able to build Api fastly and we can test with UI too. that was quite easy and helpful
Fast ApiThe most two widely created api in a life of Machine learning developer is to test there ML model via single value test and to predict the model by passing a test file
This blog is to whom who wanted to test there api with some help of UI
Prerequesties
1)Pickled Ml Model
2)fast Api Installed
I am going to show both of them in this tutorial:
Lets Dive in:
These are the following requirements for
#These are the dependency of Fastapi
pip3 install fastapi
pip3 install multipart
pip3 install uvicorn1) The first post request is to test the api with single value data
if you need to pre process the data you need to do it after getting the value or converting
it into a data frame will easy for pre processing so i have done that ,you can do it in many
ways
2) The second post request is to test the model with a test file , make sure that the target column
is removed in the test dataset.
Here we are using the Fast API methods called UploadFile and File which helps to get the file
which ever file is uploaded
At last to run this app ,make sure you have installed uvicorn in your device and can run using
uvicorn.run where you need to pass the ip address and the port number in which yout Fastapi
has to run similar to flask->run methodThe above tells how the UI will be exactly to test the first API
The above tells how the UI will be exactly to test the second APIsee the full code in my Github if you find it useful please to upvote and share the link.
Do follow me in linkedin
Thanks Prasanna...Quite interesting..!! Will try it out
ReplyDeleteThanks ,try it out and share your feedback
DeleteI've learned many things by reading the blog....tq dude.
ReplyDeleteThanks brob.. Hope you learned something new. Try it and leave your feedback
DeleteThanks Prasanna I am learning things because of your post.. Keep Going !!!
ReplyDeleteHope you learned something new...thanks for the words
Delete