Skip to content

A API for image classification with Python, TensorFlow and NestJS.

License

Notifications You must be signed in to change notification settings

peeeuzin/image-classification-api

Repository files navigation

Image Classification API

This repository is an example to see how serve a machine learning model with TensorFlow and NestJS.

Requirements

Installation

$ yarn install --frozen-lockfile
$ yarn lya:install-deps

Build the model

$ yarn lya:train

The model will be saved in ./lya-model/ directory.

Run the API in development mode

$ yarn start:dev

Run the API in production mode

$ yarn build
$ yarn start:prod

Testing the API

Routes

GET /lya/classNames - Get the class names

$ curl http://localhost:3000/lya/classNames

GET /lya/predict - Predict the class of an image

$ curl -X POST -F "image=@./path/to/image.jpg" http://localhost:3000/lya/predict