# Apps and Dashboards

cnvrg is a full-stack platform, designed to simplify every aspect of your workflow.

One important part of any data scientist’s work is presenting their work to others. That project you’ve been working on for weeks won’t go on much longer if you aren’t able to effectively communicate what you have achieved. cnvrg can make that task easier than ever.

cnvrg works easily and seamlessly with three major data communication platforms so you can use whatever is most convenient and efficient for your and your team’s needs.

The topics in this page:

# R Shiny

Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.

Learn how to use R Shiny.

# Use R Shiny

To set up an R Shiny dashboard:

  1. Navigate to Apps in your project.
  2. Click R Shiny
  3. For File, enter the full path of the R Shiny app.R file.
  4. In Advanced Settings:
    1. For Image, select the default cnvrg_r image.
    2. For Compute, click the compute you would like to use.
  5. Click Publish. cnvrg will spin up the compute and start running the R Shiny server.

NOTE

The R Shiny file must be called app.R.

If no path is given, app.R is assumed to be in the project's parent directory. If you enter the full path (in the project) for File, for example, my_folder/app.R, then that file will be loaded from the correct subdirectory.

# R Shiny logs

The logs for the R Shiny server can be found within the compute at /var/log/shiny-server

# Customize the R Shiny configuration with a custom image

You can modify the R Shiny configuration to better suit your own requirements. By default, cnvrg starts the R Shiny server using the command exec shiny-server 2>&1 and runs using the following configuration:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Define a server that listens on port 3838
server {
  listen 3838;
  # Define a location at the base URL
  location / {
    # Host the directory of Shiny Apps stored in this directory
    site_dir /cnvrg; #or a path of the app.R file
    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;
    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

If you would like to start the server in your own customized way, create a custom image and save your custom configuration file as /init. If /init exists, cnvrg will use it start the shiny server otherwise it will run with the default server startup:

#!/bin/sh
# Make sure the directory for individual app logs exists
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server
if [ "$APPLICATION_LOGS_TO_STDOUT" != "false" ];
then
    # push the "real" application logs to stdout with xtail in detached mode
    exec xtail /var/log/shiny-server/ &
fi
# start shiny server
exec shiny-server 2>&1

# Dash

Dash is a productive Python framework for building web applications.

Written on top of Flask, Plotly.js, and React.js, Dash is ideal for building data visualization apps with highly custom user interfaces in pure Python. It's particularly suited for anyone who works with data in Python.

Through a few simple patterns, Dash abstracts away all of the technologies and protocols that are required to build an interactive web-based application. Dash is simple enough that you can bind a user interface around your Python code in an afternoon.

Dash apps are rendered in the web browser. You can deploy your apps to servers and then share them through URLs. Since Dash apps are viewed in the web browser, Dash is inherently cross-platform and mobile ready.

Learn how to use Dash.

# Voilà

Voilà turns Jupyter notebooks into standalone web applications.

Not only does it create visual graphs to make reporting easier, it also democratizes Jupyter notebooks for non-technical users. With Voilà, every notebook can be turned into a Voilà app. Better yet, you can create a customized dashboard with results of your machine learning project. Voilà supports Jupyter interactive widgets, including roundtrips to the kernel. It improves the conciseness by not permitting arbitrary code execution by consumers of dashboards.

Other benefits of Voilà are that it is built upon Jupyter standard protocols and file formats, and works with any Jupyter kernel (C++, Python, Julia). This makes Voilà a language-agnostic dashboarding system. On top of everything, Voilà is extensible and includes a flexible template system to produce rich application layouts. That means you can easily customize your dashboard based on the Jupyter notebook being deployed.

# How to use apps with cnvrg

To publish a file as an app:

  1. Enter the project you want to publish your app from.
  2. Select Apps on the sidebar.
  3. Choose the app type, enter the file that will be used for the app and allocate a compute.
  4. If necessary, choose a dataset and fill in the other options.
  5. Click Publish.

cnvrg will do the rest for you!

Last Updated: 3/25/2020, 12:51:57 PM