https://github.com/dbbrandt/mm-api-py
Python FLASK API for handling requests to machine learning ml-mm-api
https://github.com/dbbrandt/mm-api-py
Last synced: 3 months ago
JSON representation
Python FLASK API for handling requests to machine learning ml-mm-api
- Host: GitHub
- URL: https://github.com/dbbrandt/mm-api-py
- Owner: dbbrandt
- Created: 2019-05-11T21:26:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-12T20:21:37.000Z (about 6 years ago)
- Last Synced: 2025-01-03T19:22:17.402Z (5 months ago)
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a light wrapper for mlmmapi to support web requests to correct_answer.
Setup:
1. sudo to precidix
2. cd srv
3. git clone https://[gitusername]@github.com/dbbrandt/mm-api-py.git
* Provided password at prompt
4. Install python 3.6
* Sudo yum install 3.6
* yum install python36-devel. (For buing gcc packages like python-Levenshtein
5. Install pip
* python3 -m pip install --user --upgrade pip
6. Setup venv
* python3 -m pip install --user virtualenv
7. Create a virtual environment
* python3 -m venv env
8. Attache to the venv
* source env/bin/activate
9. Install the needed packages
* fuzzywuzzy
* python-Levenshtein
* numpy
* pandas
* scikit-learn version 0.20.3. (for the model dump). Pip3 install scikit-learn==0.20.3
* xgboost
* Joblib
* flask
* mlmmapi
* uwsgi
10. Update nginx config
* Edit /etc/nginx/conf.d/mm-api_prodution.conf
* Add the lines under the location @puma_mm-api_production used for the normal mm-api rails app.
location /mm-api-py {
include uwsgi_params;
uwsgi_pass unix:/tmp/mm-api-py.sock;
}
11. Run the uwsgi application
* Got the /users/precidix/srv/mm-api-py directory
* Run:
* uwsgi —ini wsgi.ini &
12. Test and Restart nginx
* sudo /etc/init.d/nginx configtest
* sudo /etc/init.d/nginx restart