File size: 2,879 Bytes
f824176
45d1ec2
f824176
ebc33d1
9b54e61
 
 
2b01236
a436296
2b01236
9b54e61
 
 
 
 
 
 
 
f33d0c9
9b54e61
 
 
 
f33d0c9
9b54e61
 
9190fc9
9b54e61
 
 
 
 
45d1ec2
 
e7809e3
 
45d1ec2
 
 
 
 
 
 
 
 
 
 
 
e7809e3
45d1ec2
e7809e3
45d1ec2
 
e7809e3
45d1ec2
 
e7809e3
45d1ec2
 
e7809e3
 
 
45d1ec2
 
 
e7809e3
ebc33d1
9b54e61
 
ebc33d1
9b54e61
f824176
 
 
 
 
 
1cd1a19
f824176
9190fc9
f824176
 
122a897
 
 
f93ba69
122a897
7b883db
f4ae373
f824176
 
1cd1a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import streamlit as st 
import base64

# At the top of file with imports
def add_sticky_header_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)

def auto_scroll_to_bottom():
    # JavaScript to scroll to bottom
    js_code = """
    <script>
        // Wait for the page to fully render
        const scrollToBottom = () => {
            // Get the main Streamlit iframe
            const streamlitDoc = window.parent.document;
            // Get the app container
            const appContainer = streamlitDoc.querySelector('.main');
            if (appContainer) {
                // Scroll the app container to the bottom
                appContainer.scrollTop = appContainer.scrollHeight;
            } else {
                // Fallback to scrolling the entire page
                window.parent.scrollTo(0, streamlitDoc.body.scrollHeight);
            }
        };
        
        // Try immediately
        scrollToBottom();
        
        // Also try after a short delay to ensure content is rendered
        setTimeout(scrollToBottom, 200);
        
        // And after a longer delay just to be safe
        setTimeout(scrollToBottom, 500);
    </script>
    """
    
    # Render the JavaScript code
    html = f'<div style="display:none">{js_code}</div>'
    st.components.v1.html(html, height=0)

# At the start of main function or execution flow
add_sticky_header_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.subheader("Select specific Chapter for quicker results")
st.sidebar.header("SBS V2.0 mapper")
st.sidebar.write("(work in progress)")
st.sidebar.text("Demo by JA-RAD")


# --- 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()