kbhattmsft / cognitive

Microsoft Cognitive Services API with Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microsoft Cognitive Services API with Spring Boot

Consume Microsoft Cognitive Services API from Spring Boot application

Face API Demo

  • Face API [1] example with age and emotion attributes:
    • Git clone
    • FaceAPIDemo/mvn clean install
    • java -jar target/FaceAPIDemo-0.0.1-SNAPSHOT.jar --subscription.key=<key> --sample.url=<picture url> --face.attributes=<csv>
  • UI mode: Just hit root deployment url (e.g. http://localhost:8080)
  • API mode:
    • Make sure environment variables subscription.key, sample.url and face.attributes are populated
    • Hit /detect endpoint (e.g.http://localhost:8080/detect)
  • Replace the placeholders in application.properties as required
  • Deploy to Pivotal Cloud Foundry (PCF)
    • Launch cf cli from e.g. Azure Cloud Shell
    • cf push (sample manifest provided)
  • User provided services to bind Congnitive Services to an app running in PCF:
    • create UPSI:
      • cf cups cognitive -p '{"key":"--- API key goes here ---"}'
    • bind the service to the app. Make sure to use cognitive as the service name for the binding to work:
      • cf bind-service face-api cognitive
    • restage the app
      • cf restage face-api

[1] https://docs.microsoft.com/en-us/azure/cognitive-services/face/overview

About

Microsoft Cognitive Services API with Spring Boot


Languages

Language:Shell 36.9%Language:Java 30.3%Language:Batchfile 28.5%Language:HTML 4.3%