How to update png with same name

I have an asset folder where there are a few static photos (pngs) that would be updated / overwritten by other processes. For now I am using a callback (with an dcc.Interval to update) as follows:

@app.callback(
    Output('pic', 'children'),
    Input('intervals', 'n_intervals')
)
def update_pic(interval):
    return html.Img(src=app.get_asset_url('test.png'))

But it also shows the first graph and never gets updated. Sometimes if I reset the process sometimes it is still using the same old photo instead of the latest one.

What should I do? Thanks!

1 Like

Hi @pp123123

Dash works in the following way: it takes the files from assets when it start the program and store them virtually, then every time you can use any file from the assets folder it will take the file that has previously stored.

You need to have all the images in the assets or call the image from another source, for example: src=‘http// …img’ , you can’t update any files in the assets folder.