I am new to Plotly and dash and want to build my first app.
Is there a general option to update/refresh the whole app in a pre-defined time (such as every 5 seconds).
I know about this website (dash.plot.ly/live-update) and others, but I cannot apply on my use case.
I would highly appreciate if you may help me.
Besides reading JSON documents, I will also show PNG files. As another tool is updating these PNG and JSON files permanently, the app should refresh itself.
The current draft is as follows:
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from flask import Flask, Response
external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]
server = Flask(name)
app = dash.Dash(name, external_stylesheets=external_stylesheets, server=server)
def generate_table(dataframe, max_rows=10): return html.Table(
[html.Tr([html.Th(col) for col in dataframe.columns])] +
[html.Tr([ html.Td(dataframe.iloc[i][col]) for col in dataframe.columns ]) for i in range(min(len(dataframe), max_rows))] )
image_filename = ‘graph.png’ # replace with your own image
encoded_image = base64.b64encode(open(image_filename, ‘rb’).read()).decode(‘ascii’)
app.layout = html.Div([
if name == ‘main’:
Thank you very much in advance!