Sign inSign up

ruifma/pytorch_flask

By ruifma

•Updated over 3 years ago

Image
0

256

ruifma/pytorch_flask repository overview

⁠PyTorch Flask API

This repo contains a sample code to show how to create a Flask API server by deploying our PyTorch model. This is a sample code which goes with tutorial⁠.

If you'd like to learn how to deploy to Heroku, then check this repo⁠.

⁠Deploy with Docker

Run Docker

docker run --name pytorch_flask -p 5000:5000 -d ruifma/pytorch_flask

send the image file in a request:

curl -X POST -F file=@cat_pic.jpeg http://localhost:5000/predict

⁠Benchmarking with Apache Bench

Remove Docker:

docker stop pytorch_flask
docker rm pytorch_flask

Run Benchmark Code:

 docker run --name pytorch_flask  --cpus='4' --cpuset-cpus="4-7" -p 1047:5000 -d ruifma/pytorch_flask python benchmark.py

Benchmarking:

ab -n 100 -c 10  http://localhost:5000/predict

⁠License

The mighty MIT license. Please check LICENSE for more details.

Tag summary

Content type

Image

Digest

sha256:63d36a11a…

Size

1.9 GB

Last updated

over 3 years ago

docker pull ruifma/pytorch_flask