In this tutorial you will create a serverless application using IBM Cloud Functions that monitors the content of a Cloud Object Storage bucket for changes using triggers. Whenever an image is uploaded to the bucket a Cloud Object Storage trigger fires and invokes an action that analyzes the image content using a deep learning microservice from the Model Asset Exchange.
Out of the box the application detects objects in an image but you can easily modify the application to generate image captions or perform other kinds of analysis on images or other media types, such as text, audio, or video. The Cloud Functions source code is included for Python and Node.js.
If you are not familiar with IBM Cloud Functions or Cloud Object Storage, follow the detailed deployment instructions in the "Leverage deep learning in IBM Cloud Functions" tutorial.
If you are already familiar with IBM Cloud Functions and Cloud Object Storage you can use the shell and batch scripts in this repository to create and delete the serverless application. To use the scripts you must have a current version of the IBM Cloud CLI installed and the Cloud Functions plug-in installed.
- Create a Cloud Object Storage service instance in the IBM Cloud.
- Create service credentials for this service instance that the serverless app will use to access the bucket.
- Create a regional bucket (in
us-south
,us-east
, oreu-gb
) in this instance. - Open a terminal window.
- Customize
create_serverless_app.sh/bat
by replacing the<TODO-...>
placeholders. - Run
create_serverless_app.sh/bat
to create the application. - Open the Cloud Functions dashboard in a web browser.
- Upload a JPG/PNG image to the regional bucket and monitor the Cloud Functions activity log.
- Upload a text file to the bucket. No action should be triggered.
- Delete a previously uploaded JPG/PNG image. The corresponding JSON annotations file should be automatically removed.
To uninstall the application run delete_serverless_app.sh/bat
.