在 Shiny App 中训练模型时显示加载标志 [英] Display a Loading Sign while a model is being trained in Shiny App

查看:37
本文介绍了在 Shiny App 中训练模型时显示加载标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个 Shiny 应用程序,在该应用程序中,通过单击 actionButton,使用 caret 包训练模型.由于此训练需要时间 - 大约 4-5 分钟 - 我想在应用程序中显示加载标志或加载 GIF,在模型训练后显示结果.否则,用户将不知道发生了什么或何时训练模型.

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.

谢谢

推荐答案

可以在 ui.R 中使用加载微调器

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")) 

您可以在 https://cran 上找到有关它的更多信息.r-project.org/web/packages/shinycssloaders/README.html

这篇关于在 Shiny App 中训练模型时显示加载标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆