This repository is intended to be a sample of setting up production APIs to host machine learning models. Hosting ML models are extremely easy with Django, Flask, and Nginx.
Check out at https://ask.shawnshan.com, Django / Flask based API to classify websites and detect toxic comments.
- First Git clone current repository
git clone https://github.com/Shawn-Shan/Ask-API.git
- Install dependancy, eg. Django and Flask (strongly recommended to use
pip3 install -r requirement.txt
- Set up backend server
This will start Flask server at port 4563 (change
app.py if want different config)
- Start front end server
python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000
This will start front end server at port 8000. Access it at
- Look and WOW
Host Your Own Model
If you would like to host your own model, you need to modify the backend code, and add an end point at
@app.route('/ghate', methods=['GET']) to the url you want to host, and write your backend code to handle get requests.