I’ve been playing with JuypterDash in Colab. It’s a fantastic solution, but… it seems so slow!
My layout is a super-simple form with one dcc.Input field and 1 button, used to collect usernames in a teaching environment.
I run it in ‘external’ mode to allow trainees to open the page from their computer
Just to open the form takes upward of 30 seconds (during which “Loading” is showing). I don’t quite understand what makes it so slow…
Anyone with a recommendation?
from jupyter_dash import JupyterDash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import pandas as pd
app = JupyterDash(__name__)
db = []
# Define layout
app.layout = html.Div([
html.H1("Registration"),
html.Label([
"Your email ",
dcc.Input(
id='account-email'
)
]),
html.Button('Submit', id='submit-val', n_clicks=0),
html.P(
id='feedback-output'
)
])
# Define callback to update graph
@app.callback(
Output('feedback-output', 'children'),
Input("submit-val", "n_clicks"),
State("account-email", "value")
)
def update_output(submit, email):
if email:
db.append(dict(email=email))
return email
# Run app and display result inline in the notebook
app.run_server(mode='external')