Join us
We are going to modify the data for the training format. It will be stored as a json file.
In main app directory we found main.py file
Isside app folder Iâve created 3 folders
So, in the api/api_v1 directory I have created the api.py file which is the main point that manages all the path files.
And finally inside I have created the endpoints folder and inside I have created two (for now) files
Now we can run our server to check if the default route is working.
At this point â itâs optional, but I really like to make the configuration to use each solution as a docker image â so, letâs create a simple Dockerfile
I create Dockerfile in the main folder.
Now I can build it.
And try it.
As a first model I got Predicting House Prices Challenge from HackerRank. Day 6: Multiple Linear Regression: Predicting House Prices | HackerRank
We are going to modify the data for the training format. It will be stored as a json file.
The program that fits based on this data is a simple implementation of the linear sklearn model.
We write the state of fit using pickle to the file. This file is our model. This principle is used in virtually all AI implementations.
First, the class we need to return prediction, based on previously trained model is like (fastapi_ml/app/models/MLR_PredictingHousePrices/predict.py)
And finally we can create implementation for prediction API. Letâs modify fastapi_ml/app/api/api_v1/endpoints/predicthouseprice.py file-
To test our sollution we use eg. Postman. Sending as POST with json in body.
I hope you liked this little article.
Here is the link to this version of repository https://github.com/rafeekpro/fastapi_ml/tree/476d2d820aea4d4432ea8e02430a6d4cf7d64c63
Join other developers and claim your FAUN account now!
Backend Developer, ML, AI, GCP, Accenture
@rafeekproInfluence
Total Hits
Posts
Only registered users can post comments. Please, login or signup.