Need help with fastapi-ml-skeleton?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

eightBEC
206 Stars 56 Forks Apache License 2.0 5 Commits 2 Opened issues

Description

FastAPI Skeleton App to serve machine learning models production-ready.

Services available

!
?

Need anything else?

Contributors list

No Data

FastAPI Model Server Skeleton

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

tox
to 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.

Requirements

Python 3.6+

Installation

Install the required packages in your local environment (ideally virtualenv, conda, etc.).

bash
pip install -r requirements

Setup

  1. Duplicate the

    .env.example
    file and rename it to
    .env
  2. In the

    .env
    file configure the
    API_KEY
    entry. The key is used for authenticating our API.
    A sample API key can be generated using Python REPL:
    python
    import uuid
    print(str(uuid.uuid4()))
    

Run It

  1. Start your app with:

    bash
    uvicorn fastapi_skeleton.main:app
    
  2. Go to http://localhost:8000/docs.

  3. Click

    Authorize
    and enter the API key as created in the Setup step. Authroization
  4. You can use the sample payload from the

    docs/sample_payload.json
    file when trying out the house price prediction model using the API. Prediction with example payload

Run Tests

If you're not using

tox
, please install with:
bash
pip install tox

Run your tests with:

bash
tox

This runs tests and coverage for Python 3.6 and Flake8, Autopep8, Bandit.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.