Skip to content

Instantly share code, notes, and snippets.

@revodavid
Last active April 4, 2018 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revodavid/074c97ac83d21096d3999224460d8dba to your computer and use it in GitHub Desktop.
Save revodavid/074c97ac83d21096d3999224460d8dba to your computer and use it in GitHub Desktop.
hotdog_predict <- function(imageURL, threshold = 0.5) {
predURL <- paste0(cvision_api_endpoint_pred, "/", cvision_id,"/url?",
"iterationId=",train.id,
"&application=R"
)
body.pred <- toJSON(list(Url=imageURL[1]), auto_unbox = TRUE)
APIresponse = POST(url = predURL,
content_type_json(),
add_headers(.headers= c('Prediction-key' = cvision_pred_key)),
body=body.pred,
encode="json")
content(APIresponse)$Predictions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment