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

Serving ML easily with FastAPI

Serving ML easily with FastAPI

You know Machine Learning, your models are working well, the team likes the results… but now you need to “serve” them in an API so that others can interact with it (developers/frontend team/other systems).

In this talk, you will learn how to easily build a production-ready web (JSON) API for your ML models with FastAPI, including best practices by default... explained with memes.

With very little code, you will get automatic/interactive documentation, data validation, authentication, open standards (OpenAPI, JSON Schema, OAuth2), and the best performance available in Python (on par with Go and NodeJS).

On top of that, you will have autocompletion and type checks in your editor, even for your own data, no matter the complexity of its shape.

The talk is targeted at Machine Learning practitioners that only know the basics of web development: what is an API, HTTP, JSON, etc. But can be appropriate for anyone interested in building web APIs. It’s a very practical talk showing working code examples.

Sebastián Ramírez

July 06, 2020
Tweet

More Decks by Sebastián Ramírez

Other Decks in Technology

Transcript

  1. Who am I? Sebastián Ramírez github.com/tiangolo linkedin.com/in/tiangolo twitter.com/tiangolo Dev at

    Explosion Berlin, Germany Explosion created: I created: tiangolo.com
  2. About FastAPI • 18K GitHub stars (about 1K+ per month)

    • Used by Microsoft, Uber, Netflix, etc. • Performance in the top rank for Python @tiangolo But why would it be useful for you, Machine Learning people?
  3. FastAPI for ML people I will assume you know: •

    Machine Learning • The basics of web / API development • HTTP, JSON... @tiangolo
  4. Make it a web API @tiangolo • Show your colleagues

    • Integrate with other internal apps • Deploy to production
  5. Basic FastAPI app with body and query - docs @tiangolo

    https://somedomain.com/article/?big_model=true
  6. FastAPI - Other features @tiangolo • Dependency Injection • Security

    - OAuth2 • WebSockets • Files • Background Tasks • Easy GraphQL integration • More...
  7. Other tools @tiangolo Build great CLIs. Easy to code. Based

    on Python type hints. Functional deep learning with types, compatible with your favorite libraries. typer.tiangolo.com thinc.ai