I am generating a deepchecks report to visualize data drift. I am trying to load the .html file in a streamlit application, but Its not loading on the page.
Code snippet:
import streamlit as st
#Read the HTML file
with open("deepchecks_file.html", "r") as f: ##deepchecks: result.save_as_html("deepchecks_file")
html_data = f.read()
st.header("Deepchecks")
st.components.v1.html(html_data)
When i run the code above, i get the following result:
Thanks for posting! Not sure why your get is not rendering but you could double-check your HTML code and make sure it’s not causing ay rendering issues.
Here’s an example I used with your code:
example_page.html
<!DOCTYPE html>
<html>
<head>
<title>Example HTML Page</title>
</head>
<body>
<h1>Welcome to my HTML page</h1>
<p>This is an example paragraph of text.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</body>
</html>
app.py
import streamlit as st
# Read the HTML file
with open("example_page.html", "r") as f:
html_data = f.read()
st.header("Deepchecks")
st.write('---')
st.subheader('Using st.markdown')
st.code('''st.markdown(html_data, unsafe_allow_html=True)''', language='python')
st.markdown(html_data, unsafe_allow_html=True)
st.write('---')
st.subheader('Using st.markdown with iframe')
st.code('''st.markdown(f'<iframe srcdoc="{html_data}" width="1000" height="600"></iframe>', unsafe_allow_html=True)''', language='python')
st.markdown(f'<iframe srcdoc="{html_data}" width="1000" height="600"></iframe>', unsafe_allow_html=True)
st.write('---')
st.subheader('Using components.v1.html')
st.code('''st.components.v1.html(html_data)''', language='python')
st.components.v1.html(html_data)
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.