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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Sebastián Ramírez
April 13, 2023
Technology
390
1
Share
Intro to FastAPI: Tips and Tricks for ML
Sebastián Ramírez
April 13, 2023
More Decks by Sebastián Ramírez
See All by Sebastián Ramírez
What's new in FastAPI for AI
tiangolo
0
740
2025-10 PyCon Brasil keynote - Behind the scenes of FastAPI and friends for developers and builders
tiangolo
0
32
PyCon Taiwan Keynote - Behind the scenes of FastAPI and friends for developers and builders
tiangolo
0
220
Modern Python through FastAPI and friends - PyCon Sweden
tiangolo
0
73
Await for it: mixing async and blocking code - PyCon MEA - Dubai
tiangolo
0
59
Modern Python through FastAPI and friends - PyCon MEA - Dubai
tiangolo
0
890
CLI apps with Typer - Python type annotations and shell completion
tiangolo
0
430
Software de Colombia para el mundo
tiangolo
1
1.8k
Modern Python through FastAPI and friends - PyCon Indonesia
tiangolo
0
520
Other Decks in Technology
See All in Technology
価格.comをAI駆動で全面刷新する ー 30年分の技術的負債を返し、次の30年の土台をつくる ー / AI Engineering Summit Tokyo 2026
tkyowa
38
41k
AI活用を推進するために ファインディが下した、一つの小さな決断
starfish719
0
220
ChatworkとBPaaS 異なる特性で学んだAI機能開発の ベストプラクティス
kubell_hr
2
2.3k
サプライチェーンセキュリティの空白地帯 - 信頼できる”依存性”の未来を考える
rung
PRO
2
650
トークン数だけでは測れない — Claude Code 組織展開の効果検証から学んだこと
makikub
0
120
エンジニアは生成AIと どのように向き合うべきか? ことばの意味という観点から
verypluming
3
340
サイバーセキュリティ概論 / Introduction to Cybersecurity
ks91
PRO
0
130
生成 AI × MCP で切り拓く次世代 SRE!自律型運用への挑戦と開発者体験の進化
_awache
0
110
個人最適 から 全体最適 へ AI情報共有会・AIギルド・AI-DLC で進める カンリーの組織展開
rfdnxbro
0
1.1k
タクシーアプリ『GO』の実践的データ活用
mot_techtalk
2
100
実装は速くなった、レビューはどうする? ― 自身のレビューをAIで再現させるサーヴァントエンジニアリングのすゝめ / Implementation got faster. So what about reviews? — An invitation to Servant Engineering: Recreating your own code reviews with AI
nrslib
6
3.1k
イベントストーミングとKiroの仕様駆動開発で実現する要件の認識合わせプロセス
syobochim
7
1.1k
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
170
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2k
How to Ace a Technical Interview
jacobian
281
24k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
360
Game over? The fight for quality and originality in the time of robots
wayneb77
1
190
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
530
Context Engineering - Making Every Token Count
addyosmani
9
930
Everyday Curiosity
cassininazir
0
220
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
400
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
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