Skip to content

Django project serving Machine Learning services as per projects

Notifications You must be signed in to change notification settings

yogeshjadhav7/ml-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ml-services

Description


This Python project uses Django FrameWork and is used as REST Machine Learning microservice by my ML projects. This service is live at http://ai.yogeshjadhav.website/.

Prerequisites


Install and setup intellecto project (https://github.com/yogeshjadhav7/intellecto)

Go through the installation steps specified in the README of intellecto project. Also, it is recommended to set up pyenv and virtualenv to create a separte python environment.

Installation


Clone the repository.

git clone https://github.com/yogeshjadhav7/ml-services.git

Go to the root directory of the project.

cd ml-services/

Install the requirements.

pip install -r requirements.txt 

Apply the migrations initially.

python manage.py migrate

Test the installation by running the service.

python manage.py runserver

Production Deployment


Go to the directory.

cd path-to-root-dir-of-project

We would be using port 8000 for this service. Firstly, check whether any process is using that port. Kill the process if it is using 8000 port. This will also help in redeployment of this service by terminating the already running instance on the same port.

lsof -n -i :8000 | grep LISTEN | awk '{ print $2 }' | uniq | xargs kill -9

We would be using nohup to run the service in background. Delete the nohup.out file which is created by previously running instance of the service.

rm nohup.out

Finally, start the Django service by commanding gunicorn to load the project's WSGI module. We would be using nohup to keep the service running in background.

nohup gunicorn ml_services.wsgi:application --bind 127.0.0.1:8000 &

OR you could use the already created shell script prod.sh to deploy with your correcsponding changes.

sh prod.sh

About

Django project serving Machine Learning services as per projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages