|
import streamlit as st |
|
|
|
|
|
st.markdown(""" |
|
<style> |
|
/* Target both Streamlit native and Hugging Face iframe embedding */ |
|
/* Make the header sticky */ |
|
header[data-testid="stHeader"] { |
|
position: fixed; |
|
top: 0; |
|
left: 0; |
|
right: 0; |
|
height: auto; |
|
z-index: 999990; |
|
background-color: white; |
|
box-shadow: 0 1px 5px rgba(0,0,0,0.1); |
|
} |
|
|
|
/* For Hugging Face specific iframe handling */ |
|
section.main { |
|
padding-top: 70px; |
|
} |
|
|
|
/* Ensure content doesn't get hidden under the header */ |
|
.block-container { |
|
padding-top: 1rem; |
|
} |
|
|
|
/* Fix for Hugging Face iframe specific issues */ |
|
iframe body .stApp { |
|
padding-top: 3rem; |
|
} |
|
|
|
/* Alternative approach: Create your own sticky header container */ |
|
div.sticky-header { |
|
position: fixed; |
|
top: 0; |
|
left: 0; |
|
right: 0; |
|
z-index: 999999; |
|
background-color: white; |
|
padding: 1rem; |
|
box-shadow: 0 2px 5px rgba(0,0,0,0.1); |
|
/* Ensures content below isn't hidden */ |
|
margin-bottom: 3rem; |
|
} |
|
|
|
/* Create space below custom sticky header */ |
|
div.sticky-header-spacer { |
|
height: 6rem; |
|
} |
|
</style> |
|
""", unsafe_allow_html=True) |
|
|
|
|
|
st.title("My App with Sticky Header") |
|
|
|
|
|
|
|
|
|
|
|
st.markdown('<div class="sticky-header">', unsafe_allow_html=True) |
|
st.title("My App with Custom Sticky Header") |
|
|
|
st.markdown('</div>', unsafe_allow_html=True) |
|
|
|
|
|
st.markdown('<div class="sticky-header-spacer"></div>', unsafe_allow_html=True) |
|
|
|
|
|
|
|
st.write("Scroll down to test the sticky header") |
|
|
|
|
|
for i in range(30): |
|
st.write(f"Content block {i}") |
|
st.write("Lorem ipsum dolor sit amet, consectetur adipiscing elit.") |
|
|
|
|
|
|
|
|
|
|
|
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning") |
|
st.subheader("Select specific Chapter for quicker results") |
|
st.logo(image="images/menu_book_60dp_75FBFD.png") |
|
st.sidebar.header("SBS V2.0 mapper") |
|
st.sidebar.write("(work in progress)") |
|
st.sidebar.text("Demo by JA-RAD") |
|
|
|
|
|
|
|
|
|
pg = st.navigation(pages=[type_text_page]) |
|
|
|
pg.run() |