Skip to content

T-Sumida/ml-api-fastapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jun 12, 2021
c7c3636 · Jun 12, 2021

History

32 Commits
May 29, 2021
May 29, 2021
May 29, 2021
May 23, 2020
May 29, 2021
May 22, 2020
Jun 12, 2021
May 29, 2021
May 30, 2021
May 29, 2021
Dec 5, 2020
May 29, 2021
May 29, 2021

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