1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PowerShell で Cognitive Services の呼び出し方

Posted at

先日 Cogbot 勉強会に行った日に試したメモ
あとでもう少し真面目に書く

$EMOTION_API_KEY = '<Your API KEY>'
$URL = 'https://api.projectoxford.ai/emotion/v1.0/recognize'

$image = 'C:\Users\hoge\Desktop\1.jpg'

$result = Invoke-RestMethod `
    -Uri $URL `
    -Method Post `
    -ContentType 'application/octet-stream' `
    -Headers @{'Ocp-Apim-Subscription-Key' = $EMOTION_API_KEY } `
    -InFile $image 

$result | format-list *

faceRectangle : @{height=301; left=773; top=413; width=301}
scores        : @{anger=3.39188122E-10; contempt=6.80944259E-11; disgust=1.14517213E-08; fear=3.75176244E-11; happiness=1.
                0; neutral=8.258468E-10; sadness=2.64461564E-09; surprise=7.739051E-09}

faceRectangle : @{height=260; left=1304; top=502; width=260}
scores        : @{anger=1.08654437E-08; contempt=0.000370971655; disgust=3.1528856E-07; fear=3.752806E-09; happiness=0.990
                0218; neutral=0.009603429; sadness=3.0391775E-06; surprise=4.06609132E-07}
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?