【问题标题】:Rofxord: how to change the endpoint and connect with API Azure Cognitive Service?Rofxord:如何更改端点并与 API Azure 认知服务连接?
【发布时间】:2019-02-19 18:45:16
【问题描述】:

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

我从 Azure 认知服务项目的个人帐户中获得了密钥:

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】:

    如果您的 Roxford 库是这里的库:https://github.com/flovv/Roxford/blob/master/R/videoAnalysis_LIB.R#L182

    然后你可以在调用方法时添加区域。认知服务密钥专用于 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")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-11
      • 1970-01-01
      • 2019-10-19
      • 1970-01-01
      • 2020-01-06
      • 1970-01-01
      相关资源
      最近更新 更多