Skip to content

Examples not working #5

@vikram-rawat

Description

@vikram-rawat

examples mentioned in the documentation are not working

img_link <- "https://news.microsoft.com/uploads/2014/09/billg1_print.jpg"
call_cognitive_endpoint(
  vision$get_endpoint(),
  operation="analyze",
  body=list(url=img_link),
  options=list(details="celebrities"),
  http_verb="POST"
  )

download.file(url = img_link,destfile = 'd:/y.jpg', mode = 'wb')
img_raw <- readBin("d:/y.jpg", "raw", file.info("d:/y.jpg")$size)
call_cognitive_endpoint(
  vision$get_endpoint(),
  operation = "analyze",
  body = img_raw,
  encode = "raw",
  http_verb = "POST"
)

I get this error while doing it. In both the commands.

 Error in process_cognitive_response(response = res, handler = match.arg(http_status_handler),  : 
  Unauthorized (HTTP 401). Failed to complete Cognitive Services operation. Message:
  Access denied due to invalid subscription key or wrong API endpoint. Make
  sure to provide a valid key for an active subscription and use a correct
  regional API endpoint for your resource. 

Let me know if I am doing something wrong here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions