Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying ML apps in minutes

Deploying ML apps in minutes

Lightning talk given at PyCon DE.

Summary:

* Firefly - functions as service (open-source)
* rorodata platform - cloud platform (PaaS)
* rorolite - lite version of the platform (open-source)

Resources:

* https://firefly-python.readthedocs.io/
* http://rorodata.com/
* https://github.com/rorodata/rorolite

Anand Chitipothu

October 25, 2017
Tweet

More Decks by Anand Chitipothu

Other Decks in Technology

Transcript

  1. Who is speaking? Anand Chitipothu @anandology • Building a data

    science platform at @rorodata • Advanced programming courses at @pipalacademy • Worked at Strand Life Sciences and Internet Archive
  2. Run Start web service: $ firefly sq.square [INFO] Starting gunicorn

    19.7.1 [INFO] Listening at: http://127.0.0.1:8000 ...
  3. Use And use it with a client. >>> from firefly.client

    import Client >>> client = Client("http://127.0.0.1:8000") >>> client.square(n=4) 16
  4. Behind the scenes, it is a RESTful API. $ curl

    -d '{"n": 4}' http://127.0.0.1:8000/square 16 And supports any JSON-friendly datatype.
  5. More practical example Deploying a machine learning model. # model.py

    import pickle model = pickle.load('model.pkl') def predict(features): result = model.predict(features]) return int(result[0])
  6. Run the server using: $ firefly model.predict ... And use

    it in the client: >>> remote_model = Client("http://localhost:8080/") >>> remote_model.predict(features=[5.9, 3, 5.1, 1.8])) 2
  7. How to deploy it in the cloud? We have a

    heroku-like platform for you. http://rorodata.com/
  8. Specify services The services are specified in the roro.yml file.

    # roro.yml project: credit-risk runtime: python3 services: - name: default function: predict.predict - name: credit-grade function: credit_grade.get_credit_grade The platform allows deploying Python functions as APIs.
  9. Deploy! Run deploy command to deploy the project. $ roro

    deploy Deploying credit-risk: version 2 Building the docker image... starting services... Done. Services: default: https://credit-risk.rorocloud.io/ credit-grade: https://credit-risk--credit-grade.rorocloud.io/
  10. Run scripts and notebooks. $ roro run --size C64 train.py

    Created new job b42c12a0 $ roro run --gpu train.py Created new job b42c12a0 $ roro run:notebook Created new job 60984179 Jupyter notebook is available at: https://60984179.rorocloud.io/?token=LNRZDpHdPhGLzf00 The jupyter notebook server can be stopped using: roro stop 60984179
  11. Can I deploy it to my own server? Oh, we

    have a lite version of the platform rorolite and that is open-source. https://github.com/rorodata/rorolite
  12. The services are specified in the rorolite.yml file. # rorolite.yml

    host: 1.2.3.4 user: root services: - name: api function: predict.predict port: 8000 - name: webapp command: gunicorn -b 0.0.0.0:8080 webapp:app port: 8080 It also allows deploying Python functions as APIs.
  13. And deploy! $ rorolite deploy Deploying project version 7... ...

    Services are live at: api -- http://1.2.3.4:8000/ webapp -- http://1.2.3.4:8080/
  14. Look at logs: $ rorolite logs api 2017-10-25 04:13:12 firefly

    [INFO] Starting Firefly... 2017-10-25 04:15:12 predict function called
  15. Summary • Firefly - functions as service (open-source) • rorodata

    platform - cloud platform (PaaS) • rorolite - lite version of the platform (open-source)