import dash
from dash import dcc, html
import base64
# cat image from https://www.pexels.com/photo/white-and-grey-kitten-on-brown-and-black-leopard-print-textile-45201/
app = dash.Dash()
image_filename = 'cat.png'
image_path_at_server = 'assets/' + image_filename
image_path_webbrowser = app.get_asset_url(image_filename)
encoded_image = base64.b64encode(open(image_path_at_server, 'rb').read()).decode("utf-8")
app.layout = html.Div([
html.H3("Using a base64 image"),
html.Img(src='data:image/png;base64,{}'.format(encoded_image)),
html.H3("Using a get_asset_url"),
html.Img(src=image_path_webbrowser),
])