Get the code
View the demo
by Anthony Amanse | Published August 28, 2018
There are times when setting up your application’s server takes more than a reasonable amount of time in your development cycle. With serverless architecuture, you can get away with setting up servers and just running your code. Then you can spend more time programming your application and less time managing your server. A serverless computing platform, despite the name, is actually still using servers to execute your functions. The difference is that you only get charged for how much time it takes your code to run, and you don’t have to worry about paying for idle time. Your functions are run only by events or directly through REST APIs.
This code pattern uses a Cloudant database on IBM Cloud and triggers an action (a Cloud Function) based on changes in the database to classify images that are uploaded. It uses a serverless image recognition web app to showcase the serverless implementation. When the end users upload an image, the executed action gets the image and classifies it using Watson Visual Recognition and then tags the image based on the classifiers it got from the service.
This application demonstrates using Cloud Functions, based on Apache OpenWhisk, to get an image from a Cloudant database and classify it through a Watson Visual Recognition service. The code pattern demonstrates how actions work with data services and execute logic in response to Cloudant events.
One function, or action, is triggered by changes (in this use case, an upload of a document) in a Cloudant database. These documents are piped to another action that submits the image to Watson Visual recognition and uploads a new document in Cloudant with the classifiers produced by Watson.
This code pattern works with the following components:
This code pattern shows you how to complete the following tasks:
Find detailed technical steps for this code pattern in the README.md file in the GitHub repository.
June 13, 2019
Apply serverless architecture to event-driven integration between cloud-native applications and legacy systems of record.
June 4, 2019
Apache KafkaAPI Management+
Back to top