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
Ad

More Related Content

What's hot (12)

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

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

AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
Elana Krasner
 
Securing Serverless Architectures - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web DaySecuring Serverless Architectures - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web Day
AWS Germany
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
Chris Munns
 
Serverless architectures-with-aws-lambda
Serverless architectures-with-aws-lambdaServerless architectures-with-aws-lambda
Serverless architectures-with-aws-lambda
saifam
 
Comprehensive Guide: Web Scraping with AWS Lambda
Comprehensive Guide: Web Scraping with AWS LambdaComprehensive Guide: Web Scraping with AWS Lambda
Comprehensive Guide: Web Scraping with AWS Lambda
X-Byte Enterprise Crawling
 
Artificial Intelligence & Machine learning foundation topic in AWS
Artificial Intelligence & Machine learning foundation topic in AWS Artificial Intelligence & Machine learning foundation topic in AWS
Artificial Intelligence & Machine learning foundation topic in AWS
Varun Manik
 
Reply Labcamp Rome - AWS Zombie - Serverless and Microservices
Reply Labcamp Rome - AWS Zombie - Serverless and MicroservicesReply Labcamp Rome - AWS Zombie - Serverless and Microservices
Reply Labcamp Rome - AWS Zombie - Serverless and Microservices
Andrea Mercanti
 
Getting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless CloudGetting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless Cloud
Ian Massingham
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
Elana Krasner
 
Securing Serverless Architectures - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web DaySecuring Serverless Architectures - AWS Serverless Web Day
Securing Serverless Architectures - AWS Serverless Web Day
AWS Germany
 
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
AWS Startup Day - Boston 2018 - The Best Practices and Hard Lessons Learned o...
Chris Munns
 
Serverless architectures-with-aws-lambda
Serverless architectures-with-aws-lambdaServerless architectures-with-aws-lambda
Serverless architectures-with-aws-lambda
saifam
 
Comprehensive Guide: Web Scraping with AWS Lambda
Comprehensive Guide: Web Scraping with AWS LambdaComprehensive Guide: Web Scraping with AWS Lambda
Comprehensive Guide: Web Scraping with AWS Lambda
X-Byte Enterprise Crawling
 
Artificial Intelligence & Machine learning foundation topic in AWS
Artificial Intelligence & Machine learning foundation topic in AWS Artificial Intelligence & Machine learning foundation topic in AWS
Artificial Intelligence & Machine learning foundation topic in AWS
Varun Manik
 
Reply Labcamp Rome - AWS Zombie - Serverless and Microservices
Reply Labcamp Rome - AWS Zombie - Serverless and MicroservicesReply Labcamp Rome - AWS Zombie - Serverless and Microservices
Reply Labcamp Rome - AWS Zombie - Serverless and Microservices
Andrea Mercanti
 
Getting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless CloudGetting Started with AWS Lambda & Serverless Cloud
Getting Started with AWS Lambda & Serverless Cloud
Ian Massingham
 
Ad

Recently uploaded (20)

Process Mining and Data Science in the Financial Industry
Process Mining and Data Science in the Financial IndustryProcess Mining and Data Science in the Financial Industry
Process Mining and Data Science in the Financial Industry
Process mining Evangelist
 
Medical Dataset including visualizations
Medical Dataset including visualizationsMedical Dataset including visualizations
Medical Dataset including visualizations
vishrut8750588758
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
ISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptx
ISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptxISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptx
ISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptx
pankaj6188303
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
Deloitte - A Framework for Process Mining Projects
Deloitte - A Framework for Process Mining ProjectsDeloitte - A Framework for Process Mining Projects
Deloitte - A Framework for Process Mining Projects
Process mining Evangelist
 
183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag
fardin123rahman07
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
Simran112433
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
Ch3MCT24.pptx measure of central tendency
Ch3MCT24.pptx measure of central tendencyCh3MCT24.pptx measure of central tendency
Ch3MCT24.pptx measure of central tendency
ayeleasefa2
 
computer organization and assembly language.docx
computer organization and assembly language.docxcomputer organization and assembly language.docx
computer organization and assembly language.docx
alisoftwareengineer1
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
Molecular methods diagnostic and monitoring of infection  -  Repaired.pptxMolecular methods diagnostic and monitoring of infection  -  Repaired.pptx
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
7tzn7x5kky
 
VKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptxVKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
Principles of information security Chapter 5.ppt
Principles of information security Chapter 5.pptPrinciples of information security Chapter 5.ppt
Principles of information security Chapter 5.ppt
EstherBaguma
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbbEDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
JessaMaeEvangelista2
 
Customer Segmentation using K-Means clustering
Customer Segmentation using K-Means clusteringCustomer Segmentation using K-Means clustering
Customer Segmentation using K-Means clustering
Ingrid Nyakerario
 
Process Mining and Data Science in the Financial Industry
Process Mining and Data Science in the Financial IndustryProcess Mining and Data Science in the Financial Industry
Process Mining and Data Science in the Financial Industry
Process mining Evangelist
 
Medical Dataset including visualizations
Medical Dataset including visualizationsMedical Dataset including visualizations
Medical Dataset including visualizations
vishrut8750588758
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
ISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptx
ISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptxISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptx
ISO 9001_2015 FINALaaaaaaaaaaaaaaaa - MDX - Copy.pptx
pankaj6188303
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
Digilocker under workingProcess Flow.pptx
Digilocker  under workingProcess Flow.pptxDigilocker  under workingProcess Flow.pptx
Digilocker under workingProcess Flow.pptx
satnamsadguru491
 
Deloitte - A Framework for Process Mining Projects
Deloitte - A Framework for Process Mining ProjectsDeloitte - A Framework for Process Mining Projects
Deloitte - A Framework for Process Mining Projects
Process mining Evangelist
 
183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag
fardin123rahman07
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
1. Briefing Session_SEED with Hon. Governor Assam - 27.10.pdf
Simran112433
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
Ch3MCT24.pptx measure of central tendency
Ch3MCT24.pptx measure of central tendencyCh3MCT24.pptx measure of central tendency
Ch3MCT24.pptx measure of central tendency
ayeleasefa2
 
computer organization and assembly language.docx
computer organization and assembly language.docxcomputer organization and assembly language.docx
computer organization and assembly language.docx
alisoftwareengineer1
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
Molecular methods diagnostic and monitoring of infection  -  Repaired.pptxMolecular methods diagnostic and monitoring of infection  -  Repaired.pptx
Molecular methods diagnostic and monitoring of infection - Repaired.pptx
7tzn7x5kky
 
VKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptxVKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
Principles of information security Chapter 5.ppt
Principles of information security Chapter 5.pptPrinciples of information security Chapter 5.ppt
Principles of information security Chapter 5.ppt
EstherBaguma
 
Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..Secure_File_Storage_Hybrid_Cryptography.pptx..
Secure_File_Storage_Hybrid_Cryptography.pptx..
yuvarajreddy2002
 
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbbEDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
EDU533 DEMO.pptxccccvbnjjkoo jhgggggbbbb
JessaMaeEvangelista2
 
Customer Segmentation using K-Means clustering
Customer Segmentation using K-Means clusteringCustomer Segmentation using K-Means clustering
Customer Segmentation using K-Means clustering
Ingrid Nyakerario
 
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