Cloud functions: a FaaS for event-driven ML prediction

Skin Cancer is one of the most common cancers in the world. An AI powered product can prove greatly useful to detect this type of cancer due to the following reasons.

-The fact that the symptoms are generally visible to the naked eye.
-Additionally, an early diagnosis is proven to be instrumental in preventing fatality and assuring the recovery of the patient.

The AI product, MySkinDoc, is expected to take user input image as an upload and based on a click event predict ML results by using an ML model saved on Google Storage, which is in effect an Image Classification ML model. The click event would happen on the website or mobile app and then different GCP services would work together to achieve and end to end functionaity. The cloud function helps to tie the different parts of this implementation together. The website/mobile app would send a third party HTTP POST request, for each click event. The function in turn would use the image file from the POST request and use the saved ML model from other GCP services like Google Storage together to give a prediction result for Skin Cancer (Melanoma).

The Cloud function in this case would need to be configured with an HTTP trigger and also unauthenticated calls to the function would need to be allowed. Additionally, we would need to specify the Timeout and Memory Allocated for the function call beforehand. The default service account in use is the App Engine Service Account. In the code step of the function deployment, we get to choose from multiple runtime languages like .NetCore, Node.js, Python and Go. For our case we will be using Python. The Source code can be typed in using an Inline editor or from other available options. Finally, an entry point function name needs to be specified, this will serve as the entry point for the function. The actual code goes in the file and requirements.txt supplements the function with the required stable versions of all the python libraries in use. After this the function is ready for deployemnt.

We can now trigger the function using HTTP POST requests from a third party app. Each function call is logged and can be used for any debugging or troubleshooting. Other options include editing the function and deploying again as a new version, monitoring and metrics for number of functions calls and average function execution times etc.



Some of the other features for Cloud functions include:
-Connects and extends services to build complex applications
-End-to-end development and diagnosability using Cloud Trace and Cloud Debugger
-Automatic scaling based on events
-No server management required
-Pay only for what you use

Nikhil Philip Mathew

Get free consultation from our tech experts

Get free consultation from our tech experts

Schedule a discussion
Get free consultation from our tech experts
Get free consultation from our tech experts

Related articles you may would like to read

Connect With Us

Request a Consultation