Skip to content

This Source code demonstrates how to deploy a Pretrained Keras Model to Production.

Notifications You must be signed in to change notification settings

ItsCosmas/traffic-signs-classifier

Repository files navigation

Deploying a Pretrained Keras Model

  • This code demonstrates how to deploy a Keras Model to Production.
  • Its Subdivided into two main parts:
  1. Backend - Traffic Signs Classifier as RESTful Service

    • Python Source Code in Root ./
  2. Frontend - Consuming the RESTful service from a web app(react app).

    • React Source Code in Client Directory ./client

The trained model is available as a .h5 file name my_model.h5

The Source Code used to train the Model is available here: https://github.com/ItsCosmas/Traffic-Sign-Classification

API ENDPOINTS

- /classifier/ - accepts file.

  • Example
  1. cURL
curl --location --request POST 'http://0.0.0.0:5000/classifier/' \
--form 'file=@/path_to_file/image_filename.extension'

  1. JavaScript
var formdata = new FormData();
formdata.append("file", fileInput.files[0], "image_filename.extension");

var requestOptions = {
  method: 'POST',
  body: formdata,
  redirect: 'follow'
};

fetch("http://0.0.0.0:5000/classifier/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

- /networkimg/ - accepts a JSON object containing an image url.

  • Example Request
  1. cURL
curl --location --request POST 'http://0.0.0.0:5000/networkimg/' \
--data-raw '{
	"image_url": "https://miro.medium.com/max/400/1*nhvFD7uT718W59UlRYaIWQ.jpeg"
}'
  1. JavaScript
var raw = "{\n	\"image_url\": \"https://miro.medium.com/max/400/1*nhvFD7uT718W59UlRYaIWQ.jpeg\"\n}";

var requestOptions = {
  method: 'POST',
  body: raw,
  redirect: 'follow'
};

fetch("http://0.0.0.0:5000/networkimg/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

About

This Source code demonstrates how to deploy a Pretrained Keras Model to Production.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published