okld / streamlit-elements

Create a draggable and resizable dashboard in Streamlit, featuring Material UI widgets, Monaco editor (Visual Studio Code), Nivo charts, and more!
MIT License
730 stars 82 forks source link

Html Image error #4

Open yubeizhu opened 2 years ago

yubeizhu commented 2 years ago

When I use image component like html.Img( src = "/static/xxx.jpg"), the root location is the module's path "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit_elements/frontend/build/". So I can't load images in my own folders.

Same issus happens when I use src = "data:image/png;base64,XXXXX", which should use the bytes data.

Thanks for your job on this cool package!

okld commented 2 years ago

Hello @yubeizhu, unfortunately Streamlit Elements does not support custom static folders as you noticed. However using a base64 data URI should work. Do you have any error in your browser's developer console?

yubeizhu commented 2 years ago

Hi okld,

It seems the html.Img couldn't support base64 data uri. It report' "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit_elements/frontend/build/data:image/ping;base64,XXXXX", file name too long'.