# NOT RUN {
endp <- cognitive_endpoint("https://myvisionservice.api.cognitive.azure.com",
service_type="Computervision", key="key")
# analyze an online image
img_link <- "https://news.microsoft.com/uploads/2014/09/billg1_print.jpg"
call_cognitive_endpoint(endp,
operation="analyze",
body=list(url=img_link),
options=list(details="celebrities"),
http_verb="POST")
# analyze an image on the local machine
img_raw <- readBin("image.jpg", "raw", file.info("image.jpg")$size)
call_cognitive_endpoint(endp,
operation="analyze",
body=img_raw,
encode="raw",
http_verb="POST")
# }
Run the code above in your browser using DataLab