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

Intro to FastAPI: Tips and Tricks for ML

Intro to FastAPI: Tips and Tricks for ML

Sebastián Ramírez

April 13, 2023
Tweet

More Decks by Sebastián Ramírez

Other Decks in Technology

Transcript

  1. Intro to High performance, easy to learn, fast to code,

    ready for production Tips and Tricks for ML
  2. • Python Web API framework • 50K+ GitHub stars (about

    1K+ per month) • Used by Microsoft, Uber, Netflix, etc. • Performance in the top rank for Python • 3rd most used (Python Developers Survey) • Fastest growth (Python Developers Survey) • 3rd most loved (StackOverflow Developer Survey) @tiangolo
  3. • OpenAPI • JSON Schema • OAuth2 🔄 Automatic data

    conversion ✨ ✅ Automatic data validation ✨ FastAPI is based on standards 📝 Automatic API docs ✨ • Standard type annotations @tiangolo
  4. Basic FastAPI app with body and query - docs @tiangolo

    https://somedomain.com/food/?delivery=true
  5. FastAPI - Other features @tiangolo • Dependency Injection • Security

    - OAuth2 • WebSockets • Files • Background Tasks • Easy GraphQL integration • Templates • More...
  6. Load ML models - slow disk reads 🤖 @tiangolo ✨

    Read from disk as few times as possible ✨
  7. Blocking code in async blocks the event loop 😱 @tiangolo

    ✨ Don’t put blocking code directly in async functions ✨