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
Firefly - Deploying functions made easy
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Anand Chitipothu
July 10, 2017
Programming
800
0
Share
Firefly - Deploying functions made easy
Lightning talk given at EuroPython 2017
Anand Chitipothu
July 10, 2017
More Decks by Anand Chitipothu
See All by Anand Chitipothu
Machine Learning as a Service
anandology
0
210
DevOps for Data Science
anandology
0
110
Managing Machine Learning Models in Production - Strata Singapore 2017
anandology
0
710
Real World Challenges in Deploying Machine Learning Applications
anandology
0
430
Deploying ML apps in minutes
anandology
1
480
Recreational Programming
anandology
4
530
Managing Machine Learning Models in Production
anandology
1
680
Distributed Machine Learning - Challenges & Opportunities
anandology
0
300
Writing Beautiful Code - EuroPython 2017
anandology
3
1.4k
Other Decks in Programming
See All in Programming
まかせられるPM・まかせられないPM / DevTech GUILD Meetup
yusukemukoyama
0
110
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
590
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
Rethinking API Platform Filters
vinceamstoutz
0
11k
安いハードウェアでVulkan
fadis
1
930
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
570
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
860
Nuxt Server Components
wattanx
0
260
Swift Concurrency Type System
inamiy
0
360
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
340
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
120
アーキテクチャモダナイゼーションとは何か
nwiizo
17
4.6k
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.6k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
250
Git: the NoSQL Database
bkeepers
PRO
432
67k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
130
Designing for Performance
lara
611
70k
HDC tutorial
michielstock
1
610
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
A designer walks into a library…
pauljervisheath
211
24k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
270
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
670
Transcript
Firefly Deploying functions made easy!
Who is speaking? Anand Chitipothu @anandology • building a data
science platform at @rorodata • advanced programming courses at @pipalacademy
The problem How to expose a function as an API
for others to use?
Why? • To use it in a different environment •
Loose coupling
Use cases • Deploy a machine learning model • preprocess
an image • live price check
Challenges • Requires writing a web application • What about
authentication? • How to do data validation? • How I need write a client library too?
Welcome to Firefly Deploying functions made easy!
Code Write your function: # sq.py def square(n): return n*n
Run Start web service: $ firefly sq.square [INFO] Starting gunicorn
19.7.1 [INFO] Listening at: http://127.0.0.1:8000 ...
Use And use it with a client. >>> from firefly.client
import Client >>> client = Client("http://127.0.0.1:8000") >>> client.square(n=4) 16
Behind the scenes, it is a RESTful API. $ curl
-d '{"n": 4}' http://127.0.0.1:8000/square 16 And supports any JSON-friendly datatype.
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])
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
Authentication Firefly has built-in support for autentication. $ firefly --token
abcd1234 sq.square ... The client must pass the same token to autenticate it. >>> client = Client("http://127.0.0.1:8000", auth_token="abcd1234") >>> client.square(n=4) 16
Upcoming Features... • supporting other input and output content-types in
addition to json. (for example, a function to resize an image) • validation using type annotations • caching support
It's open source! https://github.com/rorodata/firefly To install: pip install firefly-python
Questions? • https://firefly-python.readthedocs.io/ • https://github.com/rorodata/firefly