HTML file couldn't be rendered with components.html

Problem solved, thanks to @okld :balloon:

here is how:

import base64
import streamlit as st
import streamlit.components.v1 as components
st.title('HTML test')
HtmlFile = open('sgmap.html', 'r')
raw_html = HtmlFile.read().encode("utf-8")
raw_html = base64.b64encode(raw_html).decode()
components.iframe(f"data:text/html;base64,{raw_html}", height=400)
4 Likes