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.


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


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


Anand Chitipothu

October 25, 2017


  1. Deploy ML apps in minutes Anand Chitipothu rorodata

  2. 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
  3. The problem How to expose a function as an API

    for others to use?
  4. Welcome to Firefly Deploying functions made easy!

  5. Code Write your function: # sq.py def square(n): return n*n

  6. Run Start web service: $ firefly sq.square [INFO] Starting gunicorn

    19.7.1 [INFO] Listening at: ...
  7. Use And use it with a client. >>> from firefly.client

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

    -d '{"n": 4}' 16 And supports any JSON-friendly datatype.
  9. 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])
  10. 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
  11. It's open source! https://github.com/rorodata/firefly To install: pip install firefly-python

  12. How to deploy it in the cloud? We have a

    heroku-like platform for you. http://rorodata.com/
  13. 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.
  14. 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/
  15. 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
  16. 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
  17. The services are specified in the rorolite.yml file. # rorolite.yml

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

    Services are live at: api -- webapp --
  19. 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
  20. Summary • Firefly - functions as service (open-source) • rorodata

    platform - cloud platform (PaaS) • rorolite - lite version of the platform (open-source)
  21. Resources • https://firefly-python.readthedocs.io/ • http://rorodata.com/ • https://github.com/rorodata/rorolite

  22. Thanks! Anand Chitipothu @anandology http://rorodata.com/