This is how to source a local image file to the <img> element in html:
<html>
<h1>This is an image</h1>
<img src="file:///C:/Users/MyUser/Desktop/Plotly_Dash_logo.png" alt="image"></img>
</html>
This displays the image as expected. But when I try to make the same page using the plotly dash wrapper elements, it does not work:
import dash
from dash import html, dcc
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1('This is an image'),
html.Img(src=r'file:///C:/Users/MyUser/Desktop/Plotly_Dash_logo.png', alt='image'),
])
if __name__ == '__main__':
app.run_server(host='0.0.0.0', port=8080, debug=False, use_reloader=False)
The local image file does not display. But if I replace the source with a file from the internet, like 'https://rapids.ai/assets/images/Plotly_Dash_logo.png', it works just fine.
What is going on here?