How to display the .PNG file inside HTML component?

Hi @Shikun_Chen, welcome to the Streamlit community!

The problem you are running into here is that the file reference for “Regression.png” isn’t reachable from the web browser, because the browser doesn’t have access to that file. We have an open issue for people to provide content from a directory as you’re trying to do:

In the meantime, you can see the following post, which shows how to use the open file functionality along with f-strings to embed the bytes into your code:

Best,
Randy

1 Like