Hi @jeremie:
I believe what you’re looking for is:
def render_svg(svg):
"""Renders the given svg string."""
b64 = base64.b64encode(svg.encode('utf-8')).decode("utf-8")
html = r'<img src="data:image/svg+xml;base64,%s"/>' % b64
st.write(html, unsafe_allow_html=True)
You can see an example of it’s use in this gist which you can try out by running:
streamlit run https://gist.githubusercontent.com/treuille/8b9cbfec270f7cda44c5fc398361b3b1/raw/19ce438121af7907d5d1527e36d715dcef755bd3/render_svg.py
Please note that this has only been tested in Python 3.6.