FastAPI Skeleton App to serve machine learning models production-ready.
Serving machine learning models production-ready, fast, easy and secure powered by the great FastAPI by Sebastián Ramírez](https://github.com/tiangolo).
This repository contains a skeleton app which can be used to speed-up your next machine learning project. The code is fully tested and provides a preconfigured
toxto quickly expand this sample code.
To experiment and get a feeling on how to use this skeleton, a sample regression model for house price prediction is included in this project. Follow the installation and setup instructions to run the sample model and serve it aso RESTful API.
Install the required packages in your local environment (ideally virtualenv, conda, etc.).
bash pip install -r requirements
.env.examplefile and rename it to
.envfile configure the
API_KEYentry. The key is used for authenticating our API.
python import uuid print(str(uuid.uuid4()))
Start your app with:
bash uvicorn fastapi_skeleton.main:app
Go to http://localhost:8000/docs.
Authorizeand enter the API key as created in the Setup step.
You can use the sample payload from the
docs/sample_payload.jsonfile when trying out the house price prediction model using the API.
If you're not using
tox, please install with:
bash pip install tox
Run your tests with:
This runs tests and coverage for Python 3.6 and Flake8, Autopep8, Bandit.