# pytorch-flask-api **Repository Path**: livion_i/pytorch-flask-api ## Basic Information - **Project Name**: pytorch-flask-api - **Description**: 使用flash 建立推理app 非常好用 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-11-10 - **Last Updated**: 2022-11-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 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](https://pytorch.org/tutorials/intermediate/flask_rest_api_tutorial.html). If you'd like to learn how to deploy to Heroku, then check [this repo](https://github.com/avinassh/pytorch-flask-api-heroku). ## How to Install the dependencies: pip install -r requirements.txt Run the Flask server: FLASK_ENV=development FLASK_APP=app.py flask run From another tab, send the image file in a request: curl -X POST -F file=@cat_pic.jpeg http://localhost:5000/predict ## Deploy with Docker Build image docker build --network=host -t pytorch_flask:v0 . Run Docker docker run --name pytorch_flask -p 5000:5000 -v /pytorch-flask-api-master/:/docker_demo -d pytorch_flask:v0 send the image file in a request: curl -X POST -F file=@cat_pic.jpeg http://localhost:5000/predict ## License The mighty MIT license. Please check `LICENSE` for more details.