Rofxord:如何更改端点并与API Azure Cognitive Service连接?

问题描述 投票:0回答:1

我尝试使用Roxford包连接Azure Cognitive Service。由于错误的端点,我得到了错误(在将牛津项目纳入Azure服务之后,有几个特定于区域的端点)。

我从Azure Cognitive Service项目的个人帐户中获取了密钥:

enter image description here

library(Roxford)
library(plyr)
library(rjson)
facekey <- "xxx"  #look it up on your subscription site
getFaceResponseURL("http://getwallpapers.com/wallpaper/full/5/6/4/1147292-new-women-faces-wallpaper-2880x1800-for-phone.jpg",key= facekey)
#I got error
# {"error":{"code":"Unspecified","message":"Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}}

如何将端点更改为:“https://westcentralus.api.cognitive.microsoft.com/face/v1.0”???

r azure api azure-cognitive-services rjson
1个回答
1
投票

如果你的Roxford lib就在这里:https://github.com/flovv/Roxford/blob/master/R/videoAnalysis_LIB.R#L182

然后,您可以在调用方法时添加区域。 Cognitive Services密钥专用于Azure区域,因此在使用时应使用相同的区域。如果您不记得在生成密钥时选择的区域,则会在Azure门户的概述中编写。

然后当你使用getFaceResponseUrl时:

getFaceResponseURL <- function(img.url, key, region="westus")

通过该地区:

getFaceResponseURL("http://getwallpapers.com/wallpaper/full/5/6/4/1147292-new-women-faces-wallpaper-2880x1800-for-phone.jpg", key=facekey, region="theAzureRegionOfYourKey")
© www.soinside.com 2019 - 2024. All rights reserved.