I have created an interactive folium map and I have saved it as an html file.
I would like to know whether there is a way to display it in my streamlit app.
Thanks in advance for your help
PS: I know that I can directly a folium map through streamlit via folium_static(map).
Hi @Alberto_De_Beneditti, welcome to the Streamlit community! Yes, you can use
I tried with
components.html, but instead of showing the interactive folium map I visualize a string containing the name of the file (e.g. map1.html).
You have to provide the content of the html file, not the filename.
can you show me please how to provide the content of the html file?I have the same problem.
thanks in advance.
Read the html file and keep it as a string:
import streamlit as st
path_to_html = "./the_html_file_i_wanna_show.html"
# Read file and keep in variable
with open(path_to_html,'r') as f:
html_data = f.read()
## Show in webpage
st.header("Show an external HTML")