Created
February 21, 2019 00:14
-
-
Save shaun-jacks/761d4ad9263ca043c20a4463817db5f0 to your computer and use it in GitHub Desktop.
Code for renderDataTable outputting the results from Google Cloud Vision within R Shiny app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Analysis Table #### | |
output$results <- DT::renderDataTable({ | |
if (values$analysis_type == "FACE_DETECTION") { | |
as.data.frame( | |
list( | |
joy = values$img_res$joyLikelihood, | |
sorrow = values$img_res$sorrowLikelihood, | |
anger = values$img_res$angerLikelihood, | |
surprise = values$img_res$surpriseLikelihood | |
) | |
) | |
} else if (values$analysis_type == "OBJECT_LOCALIZATION") { | |
as.data.frame( | |
list( | |
`Object Detected` = values$img_res$name, | |
Score = values$img_res$score | |
) | |
) | |
} else if (values$analysis_type == "LANDMARK_DETECTION") { | |
as.data.frame( | |
list( | |
Landmark = values$img_res$description, | |
Score = values$img_res$score | |
) | |
) | |
} else if (values$analysis_type == "LABEL_DETECTION") { | |
as.data.frame( | |
list( | |
Description = values$img_res$description, | |
Score = values$img_res$score, | |
topicality = values$img_res$topicality | |
) | |
) | |
} else if (values$analysis_type == "TEXT_DETECTION") { | |
as.data.frame( | |
list( | |
Language = values$img_res$locale, | |
Words = values$img_res$description | |
) | |
) | |
} else if (values$analysis_type == "LOGO_DETECTION") { | |
as.data.frame( | |
list( | |
Logo = values$img_res$description, | |
Score = values$img_res$score | |
) | |
) | |
} | |
}, options = list(scrollX = TRUE, searching = TRUE, scrollY = "600px", scrollCollapse = TRUE, dom = 't')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment