Giter Club home page Giter Club logo

cdsw-simple-serving-python's Introduction

cdsw-simple-serving-python

This is aim to Python version of cdsw-simple-serving.

This repo has:

  • data preparation with RDD
  • built a simple machine learning pipeline with Spark.ml
  • export built model
  • example web server code for scoring

Currently, this repo doesn't have following features:

  • export built model as PMML

requirements

pip install -r requirements.txt -c constraints.txt

Set the environment variable

  • HDFS_HOST for handling HDFS files via hdfs package

You can use this repo for:

  • as a template for collaboration with Data Engineer and Data Scientist
  • create job dependencies from data preparation to model serving

How to run sample web app

  1. Create virtualenv for your app: virtualenv -p python2 venv && source ./venv/bin/activate
  2. Install dependent libraries: pip install -r requirements-webapp.txt
  3. Run example app: spark-submit serving/web_app.py

then, you can POST data as follows:

$ curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"Temperature":23.18,"Humidity":27.272,"Light":426,"CO2":721.25,"HumidityRatio":0.00478}' http://localhost:5000/api/predict

or, if you want to use gunicorn

  1. pip install -r requirements-webapp.txt
  2. Download spark repo
  3. Install pyspark dependencies: cd some-spark-director/python && pip install -e
  4. Run example app: cd serving; gunicorn web_app:app --log-file -

cdsw-simple-serving-python's People

Contributors

chezou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.