You are on page 1of 29

Jakarta

Going Serverless w/
Cloud Function &
Vision API

Imre Nagi
Traveloka Data
@imrenagi
Imre Nagi
Previously:
Software Engineer @CERN @eBay Inc

Currently:
Software Engineer @Traveloka Data
Docker Community Leader, Indonesia

Ping me @imrenagi
Jakarta

Agenda
● Serverless Architecture
● Cloud Function
● Cloud Vision API
● Demo
Jakarta

Serverless Architecture
Jakarta

iOS

Text Analysis

Mobile Services REST API


Compute Engine
Android Image Analysis

Web
Jakarta

Text Analysis

Mobile Services
Compute Engine
Image Analysis
iOS

Text Analysis

Cloud Load Mobile Services


Balancing Compute Engine

Android Image Analysis

Text Analysis

Mobile Services
Web Compute Engine
Image Analysis
Jakarta

Text Analysis

Mobile Services
Compute Engine

iOS Image Analysis

Text Analysis

Cloud Load API Service Mobile Services


Cloud PubSub
Balancing Compute Engine Compute Engine
Android
Image Analysis

Text Analysis

Web Mobile Services


Compute Engine
Image Analysis
Jakarta

iOS

code()
Android

Web
Serverless Characteristic
● Server? Don’t care

● No upfront provisioning

● Scales as needed

● Stateless / ephemeral

https://www.slideshare.net/bretmc/serverless-with-google-cloud?from_action=save
Serverless building block in Google
Cloud Platform

Source: https://www.slideshare.net/bretmc/serverless-with-google-cloud?from_action=saveChart
Data Source Info
Jakarta

Function As
A Service (FaaS)
Cloud Function
Google Managed Serverless Block

A serverless environment to build and


connect cloud services with code Jakarta
Google Cloud Function

No server Automatic Pay as you go


management scaling

Images taken from :https://www.slideshare.net/bretmc/serverless-with-google-cloud?from_action=save


Google Cloud Function Use Case

Images taken from :https://www.slideshare.net/bretmc/serverless-with-google-cloud?from_action=save


Google Cloud Function
Event-driven serverless architecture
Hello Serverless!
// you know what it is trying to do
HTTP Trigger exports.helloHttp = (req, res) => {
res.send(`Hello Serverless Fans…:)`);
};

$ gcloud functions deploy helloHttp --entry-point


With Cloud function, you get helloHttp --trigger-http
these benefits:
● HTTP Endpoint
● Fully Qualified Domain
● SSL/TLS cert
● Autoscaling
Cloud Event Trigger
Cloud Storage & PubSub

New file uploaded

triggers

Cloud Cloud Function


Storage

Chart Data Source Info


Cloud Event Trigger
Cloud Storage & PubSub

bookingCreatedEvent {
“event_id”: “xas1sCz”,
“event_type”: “booking_created”,
“booking_id”: 1235123,
}
triggers

Cloud Pub/Sub Cloud Function

Chart Data Source Info


Cloud Event Trigger
Cloud Storage & PubSub

eKTPExtracted {
“nik”: “1423512478593247”,
New file uploaded
“name”: “syaiful”,
“birthdate”: “Jakarta, 21-07-1967“,
}
triggers
publish

Writes file

Cloud Cloud Function Cloud Pub/Sub


Storage

Chart Data Source Info


Jakarta

Cloud Vision API


Cloud Vision API
Google Powerful image analysis

Cloud Vision API enables developers to understand


the content of an image by encapsulating powerful
Jakarta
machine learning models in an easy-to-use REST API.
Text Detection
Optical Character Recognition

The Vision API can detect and extract text


from images

Image source: GCP Documentation


Label Detection
Multiple Object
Detection
Jakarta

DEMO
eKTP Information Extraction

Image
uploader OCR Vision
eKTPExtracted {
“nik”: “1423512478593247”,
“name”: “syaiful”,
Http trigger
“birthdate”: “Jakarta, 21-07-1967“,
}

Store file

Cloud Pubsub
Cloud
eKTP
Trigger Information
Publish
Message Extraction

Cloud Storage Text extraction

{"event_type":"text.recognized","data":{"results":[{"loc
ations":[],"properties":[],"mid":"","locale":"id","descripti
on":"PROVINSI DKI JAKARTA\nJAKARTA
PUSAT\nNIK\n3171082910720002\nSYAHRIAL
AFFANDY\nNama\nTempat/Tgl Lah…...
Jakarta

Thank you!

Imre Nagi, Traveloka Data


@imrenagi
Jakarta

References
https://www.slideshare.net/bretmc/serverless-with-google-cloud?from_a
ction=save
https://cloud.google.com/icons/
Jakarta

Q&A

You might also like