Skip to content

T-Sumida/ml-api-fastapi

Repository files navigation

ml-api-fastapi

API demo of running a Tensorflow model using FastAPI.

A sample of running ImageNet-based Resnet50 on Docker as a REST-API on FastAPI. API demo of running a Tensorflow model using FastAPI.

Qiitaに記載されているコードはこちら

Demo

Environment

  • WSL2
  • pipenv
  • Docker

Requirement

  • tensorflow==2.3.0
  • fastapi
  • uvicorn
  • Jinja
  • aiofiles
  • python-multipart
  • opencv-python

All of these are listed in requirements_prod.txt.

Usage

Building the Development Environment

$git clone https://github.com/T-Sumida/ml-api-fastapi.git
$cd ml-api-fastapi
$pipenv install

Model Create

$pipenv run create

SavedModel will be output under models.

Docker Deploy

# build docker image
$pipenv run build

# start docker container
$pipenv run start


# stop docker container
$pipenv run stop

Go to http://localhost:8000/docs

For Authorize in the upper right corner of the docs, enter the value of API_KEY in the .env file.

Author

T-Sumida

About

Machine learning API implementation using FastAPI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published