Display a Loading Sign while a model is being trained in Shiny App

淺唱寂寞╮ 提交于 2021-02-04 19:11:05

问题


I am making a Shiny App in which, at the click of the actionButton, a model is trained using the caret package. As this training takes time - approximately 4-5 minutes - I wanted to display a loading sign or a loading GIF in the App where results are displayed after the model is trained. Otherwise, the User wouldn't know what is happening or when the model is trained.

Thanks


回答1:


There is loading spinner which you can use in your ui.R

# loading the library
library(shinycssloaders)
withSpinner()

# For example, if you have the plot for which you would like to show loading spinner before it's gets drawn while making some data manipulation 
withSpinner(plotOutput("my_plot")) 

You can find more information about it on https://cran.r-project.org/web/packages/shinycssloaders/README.html




回答2:


You can make a progress bar. Examples are here:

https://shiny.rstudio.com/articles/progress.html



来源:https://stackoverflow.com/questions/46596996/display-a-loading-sign-while-a-model-is-being-trained-in-shiny-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!