Skip to content

Instantly share code, notes, and snippets.

@shaun-jacks
Last active February 18, 2019 07:48
Show Gist options
  • Save shaun-jacks/3fda16330bd6e5f8c6b572d0067bc46e to your computer and use it in GitHub Desktop.
Save shaun-jacks/3fda16330bd6e5f8c6b572d0067bc46e to your computer and use it in GitHub Desktop.
Observe Event of Action Button to begin RoogleVision to Cloud Vision call from specified image file-path and analysis type
#### When Analyze button toggled ####
observeEvent(input$analyze, {
if (!((values$file_uploaded) & (values$analysis_selected))) {
values$warning_inputs = "Must select an analysis and upload a file"
} else {
# Begin progress bar
shiny::withProgress(message = "Obtaining Google Vision Analysis", value = 0.1, {
shiny::incProgress(amount = 0, detail = "sending photo to Google Vision")
# send to Google Vision
values$img_res <- getGoogleVisionResponse(input$file1$datapath, feature = values$analysis_type)
shiny::incProgress(amount = .8, detail = "Done")
})
# Increment step to render new UI for stage 2
values$analysis_stage = min(values$analysis_stage + 1, 2)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment