SlideShare a Scribd company logo
1 | 5 0
Deploying Computer
Vision Model as an API
using
AWS Lambda & API
Gateway
2 | 5 0
Topic
Deploying Computer Vision Model as an
API using AWS Lambda & API Gateway
2 | 5 0
Speaker
SHIRISH GUPTA
HEAD – DATA SCIENCE & PARTNERSHIPS AT
LOAN2GROW
3 | 5 0
“Awesome. You have created a great machine learning algorithm. Am impressed by the
accuracy and love the technique. How can we implement it in our system?” Is this
something you have heard multiple times during a client or business meeting but never been able to
truthfully answer it? Worry not, this is probably faced by 90% (to be conservative) of fellow data
scientists. And AWS has many solutions for it. One of them being —
“AWS lambda function integrated with Amazon API gateway”
4 | 5 04 | 5 0
• What are AWS Lambda & Amazon API ?
• Overview of our approach
• Hands-On Training
• Login to AWS Lambda
• Understand & create a lambda_function
• Download & define layers(aka dependencies)
• Configure Amazon API gateway
• Deploy the API and test it using Postman or
Curl
Agenda for Today
5 | 5 0
AWS Lambda
AWS Lambda is an event-driven, serverless computing
platform provided by Amazon as a part of Amazon Web
Services. It is a computing service that runs code in response
to events and automatically manages the computing
resources required by that code. The concept
of serverless computing refers to the idea that you don’t
need to maintain your own servers to run these functions.
Which means you can just upload your codes (Python,
Node.js, Go, .NET, Java, Ruby) and Lambda will manage other
things like runtime, scaling, load balancing, etc.
Amazon API
Amazon API Gateway is a fully managed service that makes it
easy for developers to create, publish, maintain, monitor, and
secure APIs at any scale. APIs act as the front door for
applications to access data, business logic, or functionality
from your backend services. Using API Gateway, we can
create RESTful APIs and WebSocket APIs that enable real-
time two-way communication applications. API Gateway
supports containerized and serverless workloads, as well as
web applications.
6 | 5 0
Overview of our approa
• Write a simple OCR code using OpenCV +
Tesseract algorithm in Python language
• Configure the algorithm in AWS Lambda
• Deploy it as an API on Amazon API gateway
6 | 5 0
OCR or Optical character recognition or optical character reader is the electronic
or mechanical conversion of images of typed, handwritten or printed text into
machine-encoded text, whether from a scanned document, a photo of a
document, a scene-photo or from subtitle text superimposed on an image.
7 | 5 0
OCR or Optical
Character
RecognitionThe electronic or mechanical conversion of images of typed, handwritten
or printed text into machine-encoded text, whether from a scanned
document, a photo of a document, a scene-photo or from subtitle text
superimposed on an image.
8 | 5 0
Important Notes
• The workshop will require you to upload few python
libraries as zip files. You can download them from the
following link
• https://implayers.s3.amazonaws.com/Pillow.zip
• https://implayers.s3.amazonaws.com/tesseract-
layer.zip
• https://implayers.s3.amazonaws.com/pytesseract%3D
%3D0.3.3.zip
• Python codes & sample photos to test
https://drive.google.com/drive/folders/1jVXiI1QzOwaqW
ggY-kDGE4WTtsd2mbX5?usp=sharing
• Please refer to the following blog for other queries
https://towardsdatascience.com/aws-lambda-amazon-
api-gateway-not-as-daunting-as-they-sound-part-1-
d77b92f53626
Pre-requisites
• Python development experience
• Basics on Computer Vision and OCR
• Activated AWS account (You might need to enter your
credit card details to activate the account. Don’t worry
you won’t be charged for the same)
9 | 5 0
Let’s jump into the
workshop
1 0 | 5 0
Lambda_Function
The code (here: python) that runs on AWS Lambda is uploaded
as a Lambda function
• Event represents the event or trigger that caused the
invocation of the lambda. It’s like the input to the function.
eg: Lambda function can be triggered by an upload to S3 or
by passing some input/data via API Gateway.
• Context Provides information about the invocation,
and execution environment of your lambda. Can be used to
check the memory allocation or to retrieve the number of
milliseconds left before the execution times out. It’s like
extra or meta info provided by AWS to understand
function’s runtime.
Layers
• Although we have created the lambda function, it won’t execute
or run right away. The reason is that we haven’t downloaded or
installed the necessary libraries(dependencies) required for the
code to run.
• Like in a normal environment, we need to pip or conda install the
libraries, we will need to do the same thing for AWS lambda. We
do that by adding layers to our AWS lambda
• A ZIP archive that contains libraries, a custom runtime, or other
dependencies. With layers, you can use libraries in your function
without needing to include them in your deployment package
1 1 | 5 0
Curl Command
curl -X POST --data-binary @bookpage.jpg https://kglyy5173l.execute-api.us-east-
1.amazonaws.com/Testing
1 2 | 5 0
shirish201@gmail.com https://www.facebook.com/shirish
.gupta.180/
https://www.linkedin.com/in/shirish
-gupta-ba003742/
1 3 | 5 0
Thank you
1 4 | 5 0
Questions

More Related Content

What's hot (12)

PPTX
API Gateway with legend lambada
Squash Apps Pvt Ltd
 
PDF
Getting started with AWS amplify
Marc Schröter
 
PPTX
The Hitchhiker’s Guide to Hybrid Connectivity
BizTalk360
 
PPTX
ActiveCampaign API Developer Talks - Motivating Sales with Code
Jordan Skole
 
PDF
Chris Anderson and Yochay Kiriaty - Serverless Patterns with Azure Functions
ServerlessConf
 
PPTX
AWS - Lambda Fundamentals
Piyush Agrawal
 
PDF
What Is Serverless Computing
Capital Numbers
 
PDF
Serverless — it all started in Vegas
Martin Buberl
 
PPTX
Serverless Workflows on AWS - A Journey from SWF to Step Functions
Forrest Brazeal
 
PDF
Getting Started with Amazon EventBridge
Srushith Repakula
 
PPTX
Amazon API Gateway
Mark Bate
 
PDF
Mercari API: from Monolithic to Microservices
Tonghui Li
 
API Gateway with legend lambada
Squash Apps Pvt Ltd
 
Getting started with AWS amplify
Marc Schröter
 
The Hitchhiker’s Guide to Hybrid Connectivity
BizTalk360
 
ActiveCampaign API Developer Talks - Motivating Sales with Code
Jordan Skole
 
Chris Anderson and Yochay Kiriaty - Serverless Patterns with Azure Functions
ServerlessConf
 
AWS - Lambda Fundamentals
Piyush Agrawal
 
What Is Serverless Computing
Capital Numbers
 
Serverless — it all started in Vegas
Martin Buberl
 
Serverless Workflows on AWS - A Journey from SWF to Step Functions
Forrest Brazeal
 
Getting Started with Amazon EventBridge
Srushith Repakula
 
Amazon API Gateway
Mark Bate
 
Mercari API: from Monolithic to Microservices
Tonghui Li
 

Similar to Deploying computer vision model as api using aws lambda and api gateway (20)

PDF
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
Amazon Web Services Japan
 
PDF
What’s new in serverless - re:Invent 2020
AWS Chicago
 
PPTX
Aws meetup building_lambda
Adam Book
 
PPTX
Serverless in Action on AWS
Adrian Hornsby
 
PDF
AWS Lambda for Data Science @Celerative
Celerative
 
PPTX
Devoxx: Building AI-powered applications on AWS
Adrian Hornsby
 
PDF
Running R on AWS Lambda by Ana-Maria Niculescu
Paris Women in Machine Learning and Data Science
 
PPTX
Serverless Generative AI on AWS, AWS User Groups of Florida
CloudHesive
 
PDF
AWS Lambda updates from re:Invent
Boaz Ziniman
 
PDF
The serverless LAMP stack
⛷️ Ben Smith
 
PDF
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
PPTX
Getting Started with Serverless Architectures
AWS Summits
 
PDF
Securing Serverless Architectures - AWS Serverless Web Day
AWS Germany
 
PDF
AWS Community Day Bangkok 2019 - Build a Serverless Web Application in 30 mins
AWS User Group - Thailand
 
PPTX
Building self service framework
Rovshan Musayev
 
PPTX
AWS Serverless with Chalice
Suman Debnath
 
PPTX
Getting started with Serverless on AWS
Adrian Hornsby
 
PDF
The Best Practices and Hard Lessons Learned of Serverless Applications
Amazon Web Services LATAM
 
PDF
「リモートペアプロでマントルを突き抜けろ!」AWS Cloud9でリモートペアプロ&楽々サーバーレス開発
Atsushi Fukui
 
PDF
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Steve Androulakis
 
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
Amazon Web Services Japan
 
What’s new in serverless - re:Invent 2020
AWS Chicago
 
Aws meetup building_lambda
Adam Book
 
Serverless in Action on AWS
Adrian Hornsby
 
AWS Lambda for Data Science @Celerative
Celerative
 
Devoxx: Building AI-powered applications on AWS
Adrian Hornsby
 
Running R on AWS Lambda by Ana-Maria Niculescu
Paris Women in Machine Learning and Data Science
 
Serverless Generative AI on AWS, AWS User Groups of Florida
CloudHesive
 
AWS Lambda updates from re:Invent
Boaz Ziniman
 
The serverless LAMP stack
⛷️ Ben Smith
 
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
Getting Started with Serverless Architectures
AWS Summits
 
Securing Serverless Architectures - AWS Serverless Web Day
AWS Germany
 
AWS Community Day Bangkok 2019 - Build a Serverless Web Application in 30 mins
AWS User Group - Thailand
 
Building self service framework
Rovshan Musayev
 
AWS Serverless with Chalice
Suman Debnath
 
Getting started with Serverless on AWS
Adrian Hornsby
 
The Best Practices and Hard Lessons Learned of Serverless Applications
Amazon Web Services LATAM
 
「リモートペアプロでマントルを突き抜けろ!」AWS Cloud9でリモートペアプロ&楽々サーバーレス開発
Atsushi Fukui
 
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Steve Androulakis
 
Ad

Recently uploaded (20)

PDF
Using AI/ML for Space Biology Research
VICTOR MAESTRE RAMIREZ
 
PDF
Avatar for apidays apidays PRO June 07, 2025 0 5 apidays Helsinki & North 2...
apidays
 
PPTX
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
PDF
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
PPTX
apidays Singapore 2025 - Generative AI Landscape Building a Modern Data Strat...
apidays
 
PPTX
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
PPTX
apidays Helsinki & North 2025 - Running a Successful API Program: Best Practi...
apidays
 
PDF
apidays Singapore 2025 - Trustworthy Generative AI: The Role of Observability...
apidays
 
PPT
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
PDF
What does good look like - CRAP Brighton 8 July 2025
Jan Kierzyk
 
PDF
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
PDF
Data Retrieval and Preparation Business Analytics.pdf
kayserrakib80
 
PPTX
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
PDF
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
PPTX
Advanced_NLP_with_Transformers_PPT_final 50.pptx
Shiwani Gupta
 
PPTX
apidays Helsinki & North 2025 - Vero APIs - Experiences of API development in...
apidays
 
PDF
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
PPTX
apidays Singapore 2025 - The Quest for the Greenest LLM , Jean Philippe Ehre...
apidays
 
PDF
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
PDF
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
Using AI/ML for Space Biology Research
VICTOR MAESTRE RAMIREZ
 
Avatar for apidays apidays PRO June 07, 2025 0 5 apidays Helsinki & North 2...
apidays
 
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
OOPs with Java_unit2.pdf. sarthak bookkk
Sarthak964187
 
apidays Singapore 2025 - Generative AI Landscape Building a Modern Data Strat...
apidays
 
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
apidays Helsinki & North 2025 - Running a Successful API Program: Best Practi...
apidays
 
apidays Singapore 2025 - Trustworthy Generative AI: The Role of Observability...
apidays
 
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
What does good look like - CRAP Brighton 8 July 2025
Jan Kierzyk
 
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
Data Retrieval and Preparation Business Analytics.pdf
kayserrakib80
 
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
Advanced_NLP_with_Transformers_PPT_final 50.pptx
Shiwani Gupta
 
apidays Helsinki & North 2025 - Vero APIs - Experiences of API development in...
apidays
 
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
apidays Singapore 2025 - The Quest for the Greenest LLM , Jean Philippe Ehre...
apidays
 
NIS2 Compliance for MSPs: Roadmap, Benefits & Cybersecurity Trends (2025 Guide)
GRC Kompas
 
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
Ad

Deploying computer vision model as api using aws lambda and api gateway

  • 1. 1 | 5 0 Deploying Computer Vision Model as an API using AWS Lambda & API Gateway
  • 2. 2 | 5 0 Topic Deploying Computer Vision Model as an API using AWS Lambda & API Gateway 2 | 5 0 Speaker SHIRISH GUPTA HEAD – DATA SCIENCE & PARTNERSHIPS AT LOAN2GROW
  • 3. 3 | 5 0 “Awesome. You have created a great machine learning algorithm. Am impressed by the accuracy and love the technique. How can we implement it in our system?” Is this something you have heard multiple times during a client or business meeting but never been able to truthfully answer it? Worry not, this is probably faced by 90% (to be conservative) of fellow data scientists. And AWS has many solutions for it. One of them being — “AWS lambda function integrated with Amazon API gateway”
  • 4. 4 | 5 04 | 5 0 • What are AWS Lambda & Amazon API ? • Overview of our approach • Hands-On Training • Login to AWS Lambda • Understand & create a lambda_function • Download & define layers(aka dependencies) • Configure Amazon API gateway • Deploy the API and test it using Postman or Curl Agenda for Today
  • 5. 5 | 5 0 AWS Lambda AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is a computing service that runs code in response to events and automatically manages the computing resources required by that code. The concept of serverless computing refers to the idea that you don’t need to maintain your own servers to run these functions. Which means you can just upload your codes (Python, Node.js, Go, .NET, Java, Ruby) and Lambda will manage other things like runtime, scaling, load balancing, etc. Amazon API Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. APIs act as the front door for applications to access data, business logic, or functionality from your backend services. Using API Gateway, we can create RESTful APIs and WebSocket APIs that enable real- time two-way communication applications. API Gateway supports containerized and serverless workloads, as well as web applications.
  • 6. 6 | 5 0 Overview of our approa • Write a simple OCR code using OpenCV + Tesseract algorithm in Python language • Configure the algorithm in AWS Lambda • Deploy it as an API on Amazon API gateway 6 | 5 0 OCR or Optical character recognition or optical character reader is the electronic or mechanical conversion of images of typed, handwritten or printed text into machine-encoded text, whether from a scanned document, a photo of a document, a scene-photo or from subtitle text superimposed on an image.
  • 7. 7 | 5 0 OCR or Optical Character RecognitionThe electronic or mechanical conversion of images of typed, handwritten or printed text into machine-encoded text, whether from a scanned document, a photo of a document, a scene-photo or from subtitle text superimposed on an image.
  • 8. 8 | 5 0 Important Notes • The workshop will require you to upload few python libraries as zip files. You can download them from the following link • https://implayers.s3.amazonaws.com/Pillow.zip • https://implayers.s3.amazonaws.com/tesseract- layer.zip • https://implayers.s3.amazonaws.com/pytesseract%3D %3D0.3.3.zip • Python codes & sample photos to test https://drive.google.com/drive/folders/1jVXiI1QzOwaqW ggY-kDGE4WTtsd2mbX5?usp=sharing • Please refer to the following blog for other queries https://towardsdatascience.com/aws-lambda-amazon- api-gateway-not-as-daunting-as-they-sound-part-1- d77b92f53626 Pre-requisites • Python development experience • Basics on Computer Vision and OCR • Activated AWS account (You might need to enter your credit card details to activate the account. Don’t worry you won’t be charged for the same)
  • 9. 9 | 5 0 Let’s jump into the workshop
  • 10. 1 0 | 5 0 Lambda_Function The code (here: python) that runs on AWS Lambda is uploaded as a Lambda function • Event represents the event or trigger that caused the invocation of the lambda. It’s like the input to the function. eg: Lambda function can be triggered by an upload to S3 or by passing some input/data via API Gateway. • Context Provides information about the invocation, and execution environment of your lambda. Can be used to check the memory allocation or to retrieve the number of milliseconds left before the execution times out. It’s like extra or meta info provided by AWS to understand function’s runtime. Layers • Although we have created the lambda function, it won’t execute or run right away. The reason is that we haven’t downloaded or installed the necessary libraries(dependencies) required for the code to run. • Like in a normal environment, we need to pip or conda install the libraries, we will need to do the same thing for AWS lambda. We do that by adding layers to our AWS lambda • A ZIP archive that contains libraries, a custom runtime, or other dependencies. With layers, you can use libraries in your function without needing to include them in your deployment package
  • 11. 1 1 | 5 0 Curl Command curl -X POST --data-binary @bookpage.jpg https://kglyy5173l.execute-api.us-east- 1.amazonaws.com/Testing
  • 12. 1 2 | 5 0 [email protected] https://www.facebook.com/shirish .gupta.180/ https://www.linkedin.com/in/shirish -gupta-ba003742/
  • 13. 1 3 | 5 0 Thank you
  • 14. 1 4 | 5 0 Questions