Each year at this time, we prepare something special to help you learn Serverless once and for all with a series of challenges. This year, we decided to feature seven unique challenges, one per week. Come join us!
The solution creates a Serverless Endpoint which is used to
- List all the images stored on the Azure Blob Storage
- Upload new image on the Azure Blob Storage
- Predict the already uploaded image using Custom Vision API
- Create Resource Group
- Create Azure Blob Storage
- Create a Container
- Deploy the Custom Vision API, you can use this datasets
- Publish your prediction
git clone [email protected]:ramanaditya/Seasons-of-Serverless-Solution-Lovely-Ladoos.git
npm install
export $(grep -v '^#' .env | xargs)
Required Environment Variables are given in the .env.example
func start
- Test API using Postman
Base URL: http://localhost:7071
- /api/predict?imageurl=<Image URL>
- /api/blobs
endpoint | method | parameters | required |
---|---|---|---|
/api/predict | GET |
imageurl=<ImageURL> | True |
/api/blobs | GET |
||
POST |
[
{
"name": "11624351181437143-11108a41.jpg",
"properties": {
"createdOn": "2020-11-18T17:19:44.000Z",
"lastModified": "2020-11-18T17:19:44.000Z",
"etag": "0x8D88BE624813E21",
"contentLength": 46337,
"contentType": "image/jpeg",
"contentEncoding": "",
"contentLanguage": "",
"contentMD5": {
"type": "Buffer",
"data": []
},
"contentDisposition": "",
"cacheControl": "",
"blobType": "BlockBlob",
"leaseStatus": "unlocked",
"leaseState": "available",
"serverEncrypted": true,
"accessTier": "Hot",
"accessTierInferred": true,
"Content-CRC64": ""
},
"objectReplicationMetadata": "",
"OrMetadata": "",
"imageUrl": "https://<storage-account>.blob.core.windows.net/<container-name>/11624351181437143-11108a41.jpg"
}
]
{
"message": {
"etag": "\"0x8D88C9867471CEB\"",
"lastModified": "2020-11-19T14:35:46.000Z",
"xMsContentCrc64": {
"type": "Buffer",
"data": [236, 13, 94, 16, 86, 9, 229, 124]
},
"clientRequestId": "####-####-####-####",
"requestId": "####-####-####-####",
"version": "2020-02-10",
"date": "2020-11-19T14:35:46.000Z",
"isServerEncrypted": true,
"content-length": "0",
"server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0"
},
"url": "https://<storage-account>.blob.core.windows.net/<container-name>/image (62).jpeg"
}
[
{
"probability": "94.44%",
"tagId": "def6ab54-27d1-4604-9bd8-f05e8ec7bc13",
"tagName": "ladoo",
"tagType": "Regular"
},
{
"probability": "5.30%",
"tagId": "c0797ccb-bf83-46be-b07b-08d5f60100e1",
"tagName": "doughnut",
"tagType": "Regular"
},
{
"probability": "0.26%",
"tagId": "36c3a169-0f43-4bc7-ba0b-76845a97b607",
"tagName": "sesame",
"tagType": "Regular"
}
]