in obelics/visualization/global_visualization.py [0:0]
def simplification_mode(self):
if self.mode == "Simplification":
current_html = self.current_example["html"]
current_url = self.current_example["url"]
simplified_current_html = self.dom_tree_simplificator(current_html, type_return="str")
def display_rendered_webpages():
st.header("Rendered webpage")
st.markdown(f"Webpage url: {current_url}")
col1, col2 = st.columns(2)
with col1:
st.subheader("Raw html rendering")
st.components.v1.html(current_html, height=450, scrolling=True)
with col2:
st.subheader("Simplified html rendering")
st.components.v1.html(simplified_current_html, height=450, scrolling=True)
def display_dom_trees():
st.header("DOM trees")
col1, col2 = st.columns(2)
with col1:
st.subheader("Raw DOM tree")
rendered_dom = self.get_dom_viz_html(current_html)
st.components.v1.html(rendered_dom, height=600, scrolling=True)
with col2:
st.subheader("Simplified DOM tree")
simplified_rendered_dom = self.get_dom_viz_html(simplified_current_html)
st.components.v1.html(simplified_rendered_dom, height=600, scrolling=True)
def display_html_codes():
st.header("HTML codes")
col1, col2 = st.columns(2)
with col1:
st.subheader("Raw HTML code")
st.components.v1.html("<xmp>" + current_html + "</xmp>", height=450, scrolling=True)
with col2:
st.subheader("Simplified HTML code")
st.components.v1.html("<xmp>" + simplified_current_html + "</xmp>", height=450, scrolling=True)
display_rendered_webpages()
display_dom_trees()
display_html_codes()