GithubHelp home page GithubHelp logo

ramanaditya / seasons-of-serverless-solution-lovely-ladoos Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 3.08 MB

Serverless Solution of Predicting Accuracy of your ladoos, using Custom Vision API and Azure Functions

License: MIT License

JavaScript 93.60% Shell 6.40%
azure-functions serverless custom-vision prediction api postman blob-storage

seasons-of-serverless-solution-lovely-ladoos's Introduction

Seasons of Serverless: Solution, Lovely Ladoos

Seasons of Serverless

Blogs

About

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!

Solution

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

Pre-requisites

  • Create Resource Group
  • Create Azure Blob Storage
  • Create a Container
  • Deploy the Custom Vision API, you can use this datasets
  • Publish your prediction

Running the Serverless Functions

Clone the Project

git clone [email protected]:ramanaditya/Seasons-of-Serverless-Solution-Lovely-Ladoos.git

Install Dependencies

npm install

Export .env variables

export $(grep -v '^#' .env | xargs)

Required Environment Variables are given in the .env.example

Run the function locally

func start

Checking the Working of API endpoint

Endpoints

Base URL: http://localhost:7071

  • /api/predict?imageurl=<Image URL>
  • /api/blobs

Requests

endpoint method parameters required
/api/predict GET imageurl=<ImageURL> True
/api/blobs GET
POST

Response

/api/blobs: GET

[
  {
    "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"
  }
]

/api/blobs: POST

{
  "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"
}

/api/predict?imageurl=<Image-URL>: GET

[
  {
    "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"
  }
]

Resources

Contributors

seasons-of-serverless-solution-lovely-ladoos's People

Contributors

ramanaditya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.