Black Lives Matter. Please consider donating to Black Girls Code today.

Dash Tabs and Interval

Hi, I am new to Dash but absolutely love it.
I made a monitoring dashboard with tabs. It works beautifully, but I am struggling with the automatic updating. I tried the hidden div solution and the layout gets loaded, but not updated. I am fairly new to programming and unboxing Redis would mean a lot of effort for me. What am I doing wrong? Here is the snippet of my code:

xternal_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.config['suppress_callback_exceptions'] = True

app.layout = html.Div([
    dcc.Tabs(id="tabs-example", value='tab-1-example', children=[
        dcc.Tab(label='Balance', value='tab-1-example'),
        dcc.Tab(label='Market', value='tab-2-example'),
]),
dcc.Interval(
        id='interval-component',
        interval=50*1000, # in milliseconds
        n_intervals=0
    ),
html.Div(id='tabs-content-example'),
html.Div(id='intermediate-value', style={'display': 'none'})])

@app.callback(
    Output('intermediate-value', 'children'),
    [Input('interval-component', 'n')])
def clean_data(n):
    calculate the most important stuff here and pass it via json.dump

@app.callback(Output('tabs-content-example', 'children'),
          [Input('tabs-example', 'value'),
           Input('intermediate-value', 'children'),
           Input('interval-component', 'n')])
def render_content(tab, datasets, n):
    datasets = json.loads(datasets)
    do some calculation....
   if tab == 'tab-1-example':
       return (html.Div(...)

EDIT:

I tried with making app.layout a function, but still no refresh.

def serve_layout():
    return(html.Div([
        dcc.Tabs(id="tabs-example", value='tab-1-example', children=[
        dcc.Tab(label='Balance', value='tab-1-example'),
        dcc.Tab(label='Market', value='tab-2-example'),
 ]),
    dcc.Interval(
            id='interval-component',
            interval=50*1000, # in milliseconds
            n_intervals=0
        ),
    html.Div(id='tabs-content-example'),
    html.Div(id='intermediate-value', style={'display': 'none'})
 ]))
)
app.layout = serve_layout

I managed to solve it by doing the following: