SlideShare a Scribd company logo
Cloud Functions
& Machine Learning APIs
@carlosazaustre
carlosazaustre.es
@carlosazaustre
Carlos Azaustre
Telecommunications Engineer
Front-End Developer
CTO & CoFounder Chefly
@carlosazaustre
https://carlosazaustre.es
youtube.com/carlosazaustre
@carlosazaustre
What is Firebase?
Google Platform to build apps fast without managing infrastructure
@carlosazaustre
Firebase Services
● Realtime NoSQL Database
● User Authentication
● Storage
● Hosting
● Push Notifications
● And Cloud Functions!
(and much more)
@carlosazaustre
Cloud Functions
Develop a Backend without
managing servers.
Create functions that are triggered
by Firebase products such as
changes to data in Database, new
user sign ups via Auth, file uploads
to Storage, etc...
@carlosazaustre
How works Cloud Functions?
Firebase Product Trigger
● Database
● Storage
● Auth
● HTTPS
● Hosting
● PubSub
Function Handler
● Code write in Node.js (v6)
● You can use GCP easily
● You can use Google APIs
● You can use NPM libraries
● You can use 3rd party APIs
@carlosazaustre
What are Machine Learning APIs?
Google Cloud Platform provides
several API’s to use in opur
projects such as
● Vision API
● Speech API
● Translation API
● Natural Language API
● Video Intelligence API
Or you can train your models
with TensorFlow and Machine
Learning Engine
@carlosazaustre
Practical Example
@carlosazaustre
What is Hot Dog or Not App?
@carlosazaustre
Frontend
Cloud Storage
Firebase
Cloud Functions
Firebase
Cloud Vision API
LabelDetection
Database
Firebase
App Architecture
@carlosazaustre
1. Take a Picture
const file = event.target.files[0]
const task = firebase.storage().ref(`/uploads/${file.name}`)
task.on('state_changed', snapshot => {
// Update progress indicator
}, error => {
// Show error details
}, () => {
// Upload completed!
this.imageUrl = task.snapshot.downloadURL
})
1
2
@carlosazaustre
2. Trigger a Cloud Function
exports.isHotdog = functions.storage.object()
.onChange(event => {
...
})
/uploads/hotdog.jpg
functions.storage.object().onChange isHotdog <Function>
@carlosazaustre
3. Take a File reference on Google Cloud Storage
exports.isHotdog = functions.storage.object()
.onChange(event => {
const object = event.data
const file = `gs://${object.bucket}/${object.name}`
})
/uploads/hotdog.jpg gs://bucketName/hotdog.jpg
@carlosazaustre
Cloud Vision API
● Label Detection
● Explicit Content Detection
● Logo Detection
● Landmark Detection
● Optical Character Recognition
● Face Detection
● Image Attributes
● Web Detection
@carlosazaustre
Cloud Vision API
"labelAnnotations": [
{ "mid": "/m/0hhrcvd", "description": "frankfurter würstchen", "score": 0.96459
{ "mid": "/m/01b9xk", "description": "hot dog", "score": 0.9400299 },
{ "mid": "/m/0kdzn", "description": "sausage", "score": 0.93496704 },
{ "mid": "/m/09370d", "description": "bockwurst", "score": 0.9349343 },
{ "mid": "/m/01sn4c", "description": "kielbasa", "score": 0.9139112 },
{ "mid": "/m/079yjd", "description": "knackwurst", "score": 0.8636358 },
{ "mid": "/m/03f7_0", "description": "bologna sausage", "score": 0.8028193 },
{ "mid": "/m/038rz", "description": "german food", "score": 0.76827973 },
{ "mid": "/m/04pfxj", "description": "cervelat", "score": 0.7612521 },
{ "mid": "/m/06l9l9", "description": "vienna sausage", "score": 0.7339414 },
@carlosazaustre
Cloud Vision API
"labelAnnotations": [
{ "mid": "/m/0hhrcvd", "description": "frankfurter würstchen", "score": 0.96459
{ "mid": "/m/01b9xk", "description": "hot dog", "score": 0.9400299 },
{ "mid": "/m/0kdzn", "description": "sausage", "score": 0.93496704 },
{ "mid": "/m/09370d", "description": "bockwurst", "score": 0.9349343 },
{ "mid": "/m/01sn4c", "description": "kielbasa", "score": 0.9139112 },
{ "mid": "/m/079yjd", "description": "knackwurst", "score": 0.8636358 },
{ "mid": "/m/03f7_0", "description": "bologna sausage", "score": 0.8028193 },
{ "mid": "/m/038rz", "description": "german food", "score": 0.76827973 },
{ "mid": "/m/04pfxj", "description": "cervelat", "score": 0.7612521 },
{ "mid": "/m/06l9l9", "description": "vienna sausage", "score": 0.7339414 },
@carlosazaustre
4. Use LabelDetection from GC Vision API
return vision.labelDetection({ source: { imageUri: file } })
.then(response => {
const labels = response[0].labelAnnotations
let isHotdog = false
labels.map(label => {
if(label.description === `hot dog`) {
isHotdog = true
}
})
return admin.database().ref(`/uploads/photo`)
.update({ isHotdog })
})
const file = `gs://${object.bucket}/${object.name}`
@carlosazaustre
4. Use LabelDetection from GC Vision API
return vision.labelDetection({ source: { imageUri: file } })
.then(response => {
const labels = response[0].labelAnnotations
let isHotdog = false
labels.map(label => {
if(label.description === `hot dog`) {
isHotdog = true
}
})
return admin.database().ref(`/uploads/photo`)
.update({ isHotdog })
})
const file = `gs://${object.bucket}/${object.name}`
@carlosazaustre
5. Frontend App reacts to changes
//AppImage.vue
created() {
firebase.database()
.ref(`/upload`)
.on(value, snapshot => {
let isHotdog = snapshot.val().photo.isHotdog
this.$emit(`upload`, { isHotdog })
})
App.vue
AppHeader.vue AppImage.vue
emit (‘upload’, isHotdog)props: isHotdog
@carlosazaustre
https://github.com/carlosazaustre/pixelscamp-firebase-ml
https://hotdog-7e6aa.firebaseapp.com/

More Related Content

PDF
Api vortrag
 
PDF
Abusing text/template for data transformation
PPTX
[MongoDB.local Bengaluru 2018] Keynote
PDF
Anwendungsfaelle für Elasticsearch
PDF
Mongo db3.0 wired_tiger_storage_engine
PDF
Building Progressive Web Apps for Android and iOS
KEY
CouchDB introduction
PDF
Introduction to elasticsearch
Api vortrag
 
Abusing text/template for data transformation
[MongoDB.local Bengaluru 2018] Keynote
Anwendungsfaelle für Elasticsearch
Mongo db3.0 wired_tiger_storage_engine
Building Progressive Web Apps for Android and iOS
CouchDB introduction
Introduction to elasticsearch

Similar to PixelsCamp 2017 - Cloud Functions for Firebase and Machine Learning APIs (20)

PDF
Be a microservices hero
PDF
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
PPTX
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
PDF
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
PPTX
Building Rich Internet Applications with HTML5 and WebGL
PPTX
Weather of the Century: Design and Performance
PPTX
Building and Scaling the Internet of Things with MongoDB at Vivint
PDF
FIWARE Tech Summit - Quantum Leap - A FIWARE Ttme-series DB
KEY
2011 05-23 metrics-agilasverige-english
PDF
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
PDF
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
PPTX
Developing hybrid SharePoint apps that run on-premise and in the cloud - ESPC...
PDF
Consul ou comment bien tirer sur l’élastique
PDF
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
PPTX
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
PPTX
Read, store and create xml and json
KEY
Mongo scaling
PDF
how to use openstack api
PDF
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
PDF
Elasticsearch
Be a microservices hero
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Building Rich Internet Applications with HTML5 and WebGL
Weather of the Century: Design and Performance
Building and Scaling the Internet of Things with MongoDB at Vivint
FIWARE Tech Summit - Quantum Leap - A FIWARE Ttme-series DB
2011 05-23 metrics-agilasverige-english
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Managing Geospatial Open Data Serverlessly [AWS Community Day CH 2025]
Developing hybrid SharePoint apps that run on-premise and in the cloud - ESPC...
Consul ou comment bien tirer sur l’élastique
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Read, store and create xml and json
Mongo scaling
how to use openstack api
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Elasticsearch
Ad

More from Carlos Azaustre (19)

PDF
Introducción al JAMStack - JS Ourense
PDF
Serverless with Firebase - Launchpad Build Burgos
PDF
Your First Assistant App with DialogFlow + Firebase
PDF
Prototipado de Aplicaciones web con Firebase #CampusGivers
PDF
Workshop React + Firebase | T3chFest 2017
PPTX
Hack2Progress - Consejos para afrontar un Hackathon
PDF
Hack2Progress - Desarrollando una aplicación web con AngularJS
PDF
Angular 2 is Coming - GDG DevFest Cordoba 2015
PDF
Taller de Seo y Facebook Ads
PDF
Curso de Responsive Design
PDF
Game of Frameworks - GDG Cáceres #CodeCC
PDF
Curso Básico de AngularJS
PDF
Curso de HTML5
PDF
Chefly Keynote at ETSII
PDF
Curso de Desarrollo Web de Platzi
PDF
#PlatziConf - El camino para ser un Pro en JavaScript
PDF
Login social con node.js
PDF
Chefly: Pitch for Tetuan Valley Startup School
PDF
Nuestra experiencia emprendedora
Introducción al JAMStack - JS Ourense
Serverless with Firebase - Launchpad Build Burgos
Your First Assistant App with DialogFlow + Firebase
Prototipado de Aplicaciones web con Firebase #CampusGivers
Workshop React + Firebase | T3chFest 2017
Hack2Progress - Consejos para afrontar un Hackathon
Hack2Progress - Desarrollando una aplicación web con AngularJS
Angular 2 is Coming - GDG DevFest Cordoba 2015
Taller de Seo y Facebook Ads
Curso de Responsive Design
Game of Frameworks - GDG Cáceres #CodeCC
Curso Básico de AngularJS
Curso de HTML5
Chefly Keynote at ETSII
Curso de Desarrollo Web de Platzi
#PlatziConf - El camino para ser un Pro en JavaScript
Login social con node.js
Chefly: Pitch for Tetuan Valley Startup School
Nuestra experiencia emprendedora
Ad

Recently uploaded (20)

PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Welding lecture in detail for understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Geodesy 1.pptx...............................................
PPTX
additive manufacturing of ss316l using mig welding
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Model Code of Practice - Construction Work - 21102022 .pdf
Welding lecture in detail for understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Geodesy 1.pptx...............................................
additive manufacturing of ss316l using mig welding
Automation-in-Manufacturing-Chapter-Introduction.pdf
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
bas. eng. economics group 4 presentation 1.pptx
Mechanical Engineering MATERIALS Selection
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd

PixelsCamp 2017 - Cloud Functions for Firebase and Machine Learning APIs

  • 1. Cloud Functions & Machine Learning APIs @carlosazaustre carlosazaustre.es
  • 2. @carlosazaustre Carlos Azaustre Telecommunications Engineer Front-End Developer CTO & CoFounder Chefly @carlosazaustre https://carlosazaustre.es youtube.com/carlosazaustre
  • 3. @carlosazaustre What is Firebase? Google Platform to build apps fast without managing infrastructure
  • 4. @carlosazaustre Firebase Services ● Realtime NoSQL Database ● User Authentication ● Storage ● Hosting ● Push Notifications ● And Cloud Functions! (and much more)
  • 5. @carlosazaustre Cloud Functions Develop a Backend without managing servers. Create functions that are triggered by Firebase products such as changes to data in Database, new user sign ups via Auth, file uploads to Storage, etc...
  • 6. @carlosazaustre How works Cloud Functions? Firebase Product Trigger ● Database ● Storage ● Auth ● HTTPS ● Hosting ● PubSub Function Handler ● Code write in Node.js (v6) ● You can use GCP easily ● You can use Google APIs ● You can use NPM libraries ● You can use 3rd party APIs
  • 7. @carlosazaustre What are Machine Learning APIs? Google Cloud Platform provides several API’s to use in opur projects such as ● Vision API ● Speech API ● Translation API ● Natural Language API ● Video Intelligence API Or you can train your models with TensorFlow and Machine Learning Engine
  • 9. @carlosazaustre What is Hot Dog or Not App?
  • 10. @carlosazaustre Frontend Cloud Storage Firebase Cloud Functions Firebase Cloud Vision API LabelDetection Database Firebase App Architecture
  • 11. @carlosazaustre 1. Take a Picture const file = event.target.files[0] const task = firebase.storage().ref(`/uploads/${file.name}`) task.on('state_changed', snapshot => { // Update progress indicator }, error => { // Show error details }, () => { // Upload completed! this.imageUrl = task.snapshot.downloadURL }) 1 2
  • 12. @carlosazaustre 2. Trigger a Cloud Function exports.isHotdog = functions.storage.object() .onChange(event => { ... }) /uploads/hotdog.jpg functions.storage.object().onChange isHotdog <Function>
  • 13. @carlosazaustre 3. Take a File reference on Google Cloud Storage exports.isHotdog = functions.storage.object() .onChange(event => { const object = event.data const file = `gs://${object.bucket}/${object.name}` }) /uploads/hotdog.jpg gs://bucketName/hotdog.jpg
  • 14. @carlosazaustre Cloud Vision API ● Label Detection ● Explicit Content Detection ● Logo Detection ● Landmark Detection ● Optical Character Recognition ● Face Detection ● Image Attributes ● Web Detection
  • 15. @carlosazaustre Cloud Vision API "labelAnnotations": [ { "mid": "/m/0hhrcvd", "description": "frankfurter würstchen", "score": 0.96459 { "mid": "/m/01b9xk", "description": "hot dog", "score": 0.9400299 }, { "mid": "/m/0kdzn", "description": "sausage", "score": 0.93496704 }, { "mid": "/m/09370d", "description": "bockwurst", "score": 0.9349343 }, { "mid": "/m/01sn4c", "description": "kielbasa", "score": 0.9139112 }, { "mid": "/m/079yjd", "description": "knackwurst", "score": 0.8636358 }, { "mid": "/m/03f7_0", "description": "bologna sausage", "score": 0.8028193 }, { "mid": "/m/038rz", "description": "german food", "score": 0.76827973 }, { "mid": "/m/04pfxj", "description": "cervelat", "score": 0.7612521 }, { "mid": "/m/06l9l9", "description": "vienna sausage", "score": 0.7339414 },
  • 16. @carlosazaustre Cloud Vision API "labelAnnotations": [ { "mid": "/m/0hhrcvd", "description": "frankfurter würstchen", "score": 0.96459 { "mid": "/m/01b9xk", "description": "hot dog", "score": 0.9400299 }, { "mid": "/m/0kdzn", "description": "sausage", "score": 0.93496704 }, { "mid": "/m/09370d", "description": "bockwurst", "score": 0.9349343 }, { "mid": "/m/01sn4c", "description": "kielbasa", "score": 0.9139112 }, { "mid": "/m/079yjd", "description": "knackwurst", "score": 0.8636358 }, { "mid": "/m/03f7_0", "description": "bologna sausage", "score": 0.8028193 }, { "mid": "/m/038rz", "description": "german food", "score": 0.76827973 }, { "mid": "/m/04pfxj", "description": "cervelat", "score": 0.7612521 }, { "mid": "/m/06l9l9", "description": "vienna sausage", "score": 0.7339414 },
  • 17. @carlosazaustre 4. Use LabelDetection from GC Vision API return vision.labelDetection({ source: { imageUri: file } }) .then(response => { const labels = response[0].labelAnnotations let isHotdog = false labels.map(label => { if(label.description === `hot dog`) { isHotdog = true } }) return admin.database().ref(`/uploads/photo`) .update({ isHotdog }) }) const file = `gs://${object.bucket}/${object.name}`
  • 18. @carlosazaustre 4. Use LabelDetection from GC Vision API return vision.labelDetection({ source: { imageUri: file } }) .then(response => { const labels = response[0].labelAnnotations let isHotdog = false labels.map(label => { if(label.description === `hot dog`) { isHotdog = true } }) return admin.database().ref(`/uploads/photo`) .update({ isHotdog }) }) const file = `gs://${object.bucket}/${object.name}`
  • 19. @carlosazaustre 5. Frontend App reacts to changes //AppImage.vue created() { firebase.database() .ref(`/upload`) .on(value, snapshot => { let isHotdog = snapshot.val().photo.isHotdog this.$emit(`upload`, { isHotdog }) }) App.vue AppHeader.vue AppImage.vue emit (‘upload’, isHotdog)props: isHotdog