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

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

Be a microservices hero
Be a microservices heroBe a microservices hero
Be a microservices hero
OpenRestyCon
 
Day 4 - Cloud Migration - But How?
Day 4 - Cloud Migration - But How?Day 4 - Cloud Migration - But How?
Day 4 - Cloud Migration - But How?
Amazon Web Services
 
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
Grokking TechTalk 9 - Building a realtime & offline editing service from scra...
Grokking VN
 
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation FrameworkConceptos básicos. Seminario web 5: Introducción a Aggregation Framework
Conceptos básicos. Seminario web 5: Introducción a Aggregation Framework
MongoDB
 
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
 Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data... Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Web applications for Interactive Hadoop by ENRICO BERTI at Big Data...
Big Data Spain
 
Building Rich Internet Applications with HTML5 and WebGL
Building Rich Internet Applications with HTML5 and WebGLBuilding Rich Internet Applications with HTML5 and WebGL
Building Rich Internet Applications with HTML5 and WebGL
Tony Parisi
 
AWS CloudFormation Best Practices
AWS CloudFormation Best PracticesAWS CloudFormation Best Practices
AWS CloudFormation Best Practices
Amazon Web Services
 
Weather of the Century: Design and Performance
Weather of the Century: Design and PerformanceWeather of the Century: Design and Performance
Weather of the Century: Design and Performance
MongoDB
 
Building and Scaling the Internet of Things with MongoDB at Vivint
Building and Scaling the Internet of Things with MongoDB at Vivint Building and Scaling the Internet of Things with MongoDB at Vivint
Building and Scaling the Internet of Things with MongoDB at Vivint
MongoDB
 
FIWARE Tech Summit - Quantum Leap - A FIWARE Ttme-series DB
FIWARE Tech Summit - Quantum Leap - A FIWARE Ttme-series DBFIWARE Tech Summit - Quantum Leap - A FIWARE Ttme-series DB
FIWARE Tech Summit - Quantum Leap - A FIWARE Ttme-series DB
FIWARE
 
2011 05-23 metrics-agilasverige-english
2011 05-23 metrics-agilasverige-english2011 05-23 metrics-agilasverige-english
2011 05-23 metrics-agilasverige-english
Mårten Gustafson
 
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Making your elastic cluster perform - Jettro Coenradie - Codemotion Amsterdam...
Codemotion
 
Developing hybrid SharePoint apps that run on-premise and in the cloud - ESPC...
Developing hybrid SharePoint apps that run on-premise and in the cloud - ESPC...Developing hybrid SharePoint apps that run on-premise and in the cloud - ESPC...
Developing hybrid SharePoint apps that run on-premise and in the cloud - ESPC...
Bram de Jager
 
Consul ou comment bien tirer sur l’élastique
 Consul ou comment bien tirer sur l’élastique Consul ou comment bien tirer sur l’élastique
Consul ou comment bien tirer sur l’élastique
Nicolas Ledez
 
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreScaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Dropsolid
 
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
 Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
Conceptos básicos. Seminario web 2: Su primera aplicación MongoDB
MongoDB
 
Read, store and create xml and json
Read, store and create xml and jsonRead, store and create xml and json
Read, store and create xml and json
Kim Berg Hansen
 
how to use openstack api
how to use openstack apihow to use openstack api
how to use openstack api
Liang Bo
 
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Firefox OS, the Open Web & WebAPIs - Geek Meet VästeråsFirefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Firefox OS, the Open Web & WebAPIs - Geek Meet VästeråsRobert Nyman
 

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

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

More from Carlos Azaustre

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

More from Carlos Azaustre (19)

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

Recently uploaded

Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 

Recently uploaded (20)

Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 

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