Skip to content

Instantly share code, notes, and snippets.

@rodrigomf24
Last active April 6, 2020 19:29
Show Gist options
  • Save rodrigomf24/761cd2846d323106abc1da095aba6c28 to your computer and use it in GitHub Desktop.
Save rodrigomf24/761cd2846d323106abc1da095aba6c28 to your computer and use it in GitHub Desktop.

Pie's Recaptcha

Instructions

Use the unsplash API to fetch images with the following search criteria pies, cookies, and random. Present them to the user(at least 6 images) in a row layout with a message indicating the user to select the images that have pies. When the user clicks on an image you will need to validate if the image is a pie by using the clarifai api(make sure you don't make a request for the same image twice).

If the image is valid, make it visible on the UI by adding a green border around the image. When the user has validated all images that are pies you should present a message back to the user that all selections are valid.

Unsplash API https://source.unsplash.com/1600x900/?pie,cookie,random

A fetch to the above url will return a single image

Clarifai API https://api.clarifai.com/v2/models/bd367be194cf45149e75f01d59f77ba7/outputs

Clarifai API required headers

  • Authorization: "Key 10a253b5940d49eab778ec456dff4a55"
  • Content-Type: "application/json"

Clarifai API request payload sample

{
  inputs: [
    {
      data: {
        image: {
          url: <image url to evaluate>
        }
      }
    }
  ]
}

Clarifai API sample response

{
  status: {
    description: "ok"
  },
  outputs: [{
    data: {
      concepts: [{name: "pie"}, {name: "cake"}, {name: "cookie"}]
    }
  }]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment