Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Intro to FastAPI: Tips and Tricks for ML
Search
Sebastián Ramírez
April 13, 2023
Technology
1
380
Intro to FastAPI: Tips and Tricks for ML
Sebastián Ramírez
April 13, 2023
Tweet
Share
More Decks by Sebastián Ramírez
See All by Sebastián Ramírez
What's new in FastAPI for AI
tiangolo
0
650
2025-10 PyCon Brasil keynote - Behind the scenes of FastAPI and friends for developers and builders
tiangolo
0
29
PyCon Taiwan Keynote - Behind the scenes of FastAPI and friends for developers and builders
tiangolo
0
200
Modern Python through FastAPI and friends - PyCon Sweden
tiangolo
0
66
Await for it: mixing async and blocking code - PyCon MEA - Dubai
tiangolo
0
46
Modern Python through FastAPI and friends - PyCon MEA - Dubai
tiangolo
0
880
CLI apps with Typer - Python type annotations and shell completion
tiangolo
0
410
Software de Colombia para el mundo
tiangolo
1
1.8k
Modern Python through FastAPI and friends - PyCon Indonesia
tiangolo
0
510
Other Decks in Technology
See All in Technology
銀行の内製開発にて2つのプロダクトを1つのチームでスクラムしてみてる話
koba1210
1
130
Kubernetesにおける推論基盤
ry
1
390
Claude Code Skills 勉強会 (DevelersIO向けに調整済み) / claude code skills for devio
masahirokawahara
1
21k
[E2]CCoEはAI指揮官へ。Bedrock×MCPで構築するコスト・セキュリティ自律運用基盤
taku1418
0
170
親子 or ペアで Mashup for the Future! しゃべって楽しむ 初手AI駆動でものづくり体験
hiroramos4
PRO
0
130
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
Everything Claude Code を眺める
oikon48
7
4.3k
AWS DevOps Agent vs SRE俺 / AWS DevOps Agent vs me, the SRE
sms_tech
3
830
マルチアカウント環境でSecurity Hubの運用!導入の苦労とポイント / JAWS DAYS 2026
genda
0
690
ナレッジワーク IT情報系キャリア研究セッション資料(情報処理学会 第88回全国大会 )
kworkdev
PRO
0
200
SRE NEXT 2026 CfP レビュアーが語る聞きたくなるプロポーザルとは?
yutakawasaki0911
1
340
ランサムウエア対策してますか?やられた時の対策は本当にできてますか?AWSでのリスク分析と対応フローの泥臭いお話。
hootaki
0
140
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
270
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
390
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
240
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
110
How to Ace a Technical Interview
jacobian
281
24k
Amusing Abliteration
ianozsvald
0
130
Six Lessons from altMBA
skipperchong
29
4.2k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
85
Transcript
Intro to High performance, easy to learn, fast to code,
ready for production Tips and Tricks for ML
Who am I? Sebastián Ramírez github.com/tiangolo linkedin.com/in/tiangolo twitter.com/tiangolo tiangolo.com Berlin,
Germany I created:
• 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
• OpenAPI • JSON Schema • OAuth2 🔄 Automatic data
conversion ✨ ✅ Automatic data validation ✨ FastAPI is based on standards 📝 Automatic API docs ✨ • Standard type annotations @tiangolo
Based on standards - for free @tiangolo
Based on Python type hints • Autocompletion everywhere • Type
checks and type errors @tiangolo
Types provide autocompletion @tiangolo
Easy and short @tiangolo
Less API code @tiangolo
Basic FastAPI app @tiangolo https://somedomain.com/items/5?q=some+query
Basic FastAPI app - docs @tiangolo https://somedomain.com/docs
Automatic docs @tiangolo
Basic FastAPI app with body @tiangolo
Basic FastAPI app with body - docs @tiangolo
Basic FastAPI app with body - docs @tiangolo
Basic FastAPI app with body @tiangolo
Basic FastAPI app with body and query @tiangolo
Basic FastAPI app with body and query - docs @tiangolo
https://somedomain.com/food/?delivery=true
Basic FastAPI app with body and query @tiangolo
JSON array of objects in body @tiangolo
JSON array of objects in body - docs @tiangolo
JSON array of objects in body @tiangolo
JSON array of objects in body - invalid data @tiangolo
JSON array of objects in body - validation @tiangolo
Data validation @tiangolo
FastAPI auto-completion @tiangolo
Type checks @tiangolo
All based on standard Python types @tiangolo
FastAPI - Performance @tiangolo
FastAPI - Performance @tiangolo
FastAPI - Other features @tiangolo • Dependency Injection • Security
- OAuth2 • WebSockets • Files • Background Tasks • Easy GraphQL integration • Templates • More...
Simple ML model and usage 🤖 @tiangolo
Load ML models - slow disk reads 🤖 @tiangolo ✨
Read from disk as few times as possible ✨
Load ML models - slow disk reads 🤖 @tiangolo
Simple ML model - only load 🤖 @tiangolo
ML model in FastAPI - simple - good ✅ @tiangolo
ML model in FastAPI - bad 🚨 @tiangolo
ML model in FastAPI - very bad 🚨 @tiangolo
ML model in FastAPI - very bad 🚨 @tiangolo
Load model and cache 😎 @tiangolo
FastAPI with cached model ⚡ @tiangolo
FastAPI with cached model ⚡ @tiangolo
FastAPI - preload cached model in healthcheck ⚡ @tiangolo
FastAPI - preload ⚡ @tiangolo
FastAPI - async and models - bad 🚨 @tiangolo
FastAPI - async and models - bad 🚨 @tiangolo
Blocking code in async blocks the event loop 😱 @tiangolo
✨ Don’t put blocking code directly in async functions ✨
FastAPI - non async and models - simple - good
✅ @tiangolo
FastAPI - non async and models - simple - good
✅ @tiangolo
FastAPI - async and models - good ✅ @tiangolo
FastAPI - async and models - good ✅ @tiangolo
FastAPI - model in dependency ✨ @tiangolo
FastAPI - model in dependency - testing ✅ @tiangolo
FastAPI - model in dependency - testing ✅ @tiangolo
FastAPI - squeeze performance 🚤 @tiangolo
FastAPI - squeeze performance 🚤 @tiangolo
None
Thank you! Sebastián Ramírez tiangolo.com fastapi.tiangolo.com github.com/tiangolo linkedin.com/in/tiangolo twitter.com/tiangolo