Skip to content

Recyclops-LifeHack-2022-Singapore/recyclops-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recyclops Backend

The backend which serves the pytorch model for image inference

Technologies

Tech Version
Python 3.9.5
Flask 2.1.2
PyTorch 1.12.0

Usage

The server only exposes a single POST request on {hostname}/predict

Using Curl

curl -X POST -F file=@"<path to img>" {hostname}/predict

Setup (Local)

This setup was only tested on python 3.9.5

  1. Install python dependencies
pip install -r requirements.txt
  1. (Optional) edit model & label maps in app.py
MODEL_PATH = 'models/resnet_large_resize_150_cpu.model'
LABEL_MAP_PATH = 'label_maps/full_label_map.json'

Note: Label maps must correspond to the model used (specified in the file name)

  1. Run server
flask run

Deployment (Heroku)

Do use the heroku branch if you're following this steps

  1. Setup new heroku
heroku login -i
heroku create <app name>
  1. Setup heroku remote and push
heroku git:remote -a <app name>
git push heroku heroku:master
  1. Setup environments for model & label map
heroku config:set MODEL_PATH=models/resnet_large_resize_150_cpu.model
heroku config:set LABEL_MAP_PATH=label_maps/full_label_map.json

The server should be up by now

Note: Feel free to change the model path and label map path, however as mentioned above do make sure they correspond to each other

About

Backend repository for recyclops

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages