sbsmapper / app.py
georad's picture
Update app.py
1b37b79 verified
raw
history blame
2.44 kB
import streamlit as st
import streamlit.components.v1 as components
# At the top of file with imports
def add_sticky_footer_css():
st.markdown("""
<style>
/* Make Streamlit's stMainMenu button aqua */
[data-testid="stMainMenu"] {
background-color: #00FFFF;
}
/* Make Streamlit's status widget sticky */
[data-testid="stStatusWidget"] {
position: fixed;
bottom: 0;
right: 0;
z-index: 1000;
background-color: yellow; /* #90EE90 */
padding: 5px;
border-top: 1px solid #f0f0f0;
width: 100%;
}
/* Add padding to main content to prevent overlap with fixed header */
.main .block-container {
padding-top: 5rem;
padding-bottom: 3rem;
}
</style>
""", unsafe_allow_html=True)
# At the start of main function or execution flow
# add_sticky_footer_css()
# Rest of app continues...
# --- PAGE SETUP ---
type_text_page = st.Page(
page="pages/type_text.py",
title="DEMO (work in progress)",
icon=":material/keyboard:",
default=True,)
# --- Your Streamlit App ---
st.logo(image="images/menu_book_60dp_75FBFD.png")
#st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
#st.title("Select specific Chapter (quicker)")
st.sidebar.header("SBS V2.0 mapper")
st.sidebar.subheader("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
st.sidebar.text("Select specific Chapter for quicker results")
st.sidebar.text("Demo by JA-RAD (work in progress)")
#st.sidebar.text("(work in progress)")
# --- NAVIGATION SETUP ---
pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
##pg = st.navigation({"Chapter_Index": [start_page], "Demo": [type_text_page, upload_file_page], "About": [about_page]}) # WITH SECTIONS
pg.run()
# Add a dummy element at the bottom
# st.markdown('<div id="bottom"></div>', unsafe_allow_html=True)
# JavaScript to scroll the dummy element into view
scroll_script = """
<script>
document.addEventListener('DOMContentLoaded', function() {
const bottomElement = window.parent.document.getElementById('bottom');
if (bottomElement) {
bottomElement.scrollIntoView({ behavior: 'smooth', block: 'end' });
}
});
</script>
"""
# Inject the script
components.html(scroll_script, height=0, width=0)