Skip to content

idealo/falcon-prediction-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Machine Learning Web API Example with Falcon

Simple example that uses Falcon to create a deep learning RESTful prediction service (simple convnet trained on the MNIST dataset). Locust is used for load testing. Gunicorn as WSGI HTTP Server and nginx as HTTP proxy server.

Getting Started

Run prediction service

docker build -t falcon-prediction-app .
docker run -p 127.0.0.1:8000:8081 falcon-prediction-app

Test prediction service

(echo -n '{"image": "'; base64 src/tests/data/four_test.png; echo '"}') |
curl -i -H "Content-Type: application/json" -d @- http://127.0.0.1:8000/predict

Run unittests

pytest -s src/tests/

Run load testing

locust -f load_testing.py --host=http://127.0.0.1:8000

Note: Access the Locust GUI via http://localhost:8089/ to start load testing.

Dependencies

  • Python conda environment (install with conda env create --file environment.yml)
  • Gunicorn
  • Falcon
  • Keras
  • Tensorflow
  • Pillow
  • Locust

Copyright

See LICENSE for details.