Skip to content

Microsoft Cognitive Services API with Spring Boot

Notifications You must be signed in to change notification settings

kbhattmsft/cognitive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published