Analyze object storage data using a serverless SQL query
Trigger functions that analyze images and aggregate their classes or tags
This code pattern demonstrates how to deploy serverless functions that analyze user uploaded images using visual recognition, store the results in a cloud object storage bucket, and trigger an SQL query that aggregates the various image classes and tags.
In this application, you first upload an image to a cloud object storage bucket, which triggers serverless functions to run visual recognition on the image and store the results into a different bucket. The storage of the results into that bucket triggers your SQL query to aggregate all of the stored image processing results, counting the various types of classes and tags found in all of the uploaded images.
When you have completed this code pattern, you will understand how to:
- Set up a cloud object storage instance on IBM Cloud.
- Set up an SQL query instance on IBM Cloud.
- Create and deploy IBM Cloud Functions from a manifest.yaml file.
- Access IBM Cloud Object Storage and IBM Cloud SQL Query from IBM Cloud Functions.
- Create triggers that react to changes in your cloud object storage buckets.
- A new image is uploaded to the Cloud Object Storage bucket.
- A trigger listening to the Cloud Object Storage bucket is fired.
- That trigger fires the visual recognition functions to run, which use the IBM Cloud Visual Recognition service to analyze the content of the image and then parse the results. Those parsed results are written back to Cloud Object Storage, in a new bucket.
- A trigger listening to that bucket is fired.
- That trigger fires the SQL query functions to run, which use the IBM Cloud SQL Query service to aggregate all of the visual recognition results stored in Cloud Object Storage.
- The results are stored in Cloud Object Storage.
Ready to give it a try? See the README file for detailed instructions.
- Create required services on IBM Cloud.
- Log in and set up your IBM Cloud CLI with the Cloud Functions plugin.
- Create the required IAM policy for Cloud Functions to access Cloud Object Storage.
- Deploy the SQL Query and Cloud Object Storage packages.
- Bind the required service credentials to the Cloud Object Storage package.
- Create the required environment variables and deploy cloud functions.
- Try out your new actions.