Update app.py
Browse files
app.py
CHANGED
@@ -1,49 +1,65 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
# --- Page Configuration ---
|
4 |
# This sets the title and icon that appear in the default header
|
5 |
st.set_page_config(
|
6 |
-
page_title="SBS V2.0 mapper", # This title will appear in the
|
7 |
page_icon=":material/keyboard:", # This icon can also appear in the header
|
8 |
layout="wide" # Optional: Use wide layout
|
9 |
)
|
10 |
|
11 |
-
# --- Custom CSS for
|
12 |
st.markdown("""
|
13 |
<style>
|
14 |
-
/* Make the default Streamlit header
|
15 |
header {
|
16 |
-
position:
|
17 |
-
top: 0;
|
18 |
-
|
|
|
|
|
19 |
background-color: rgb(240, 242, 246); /* Match Streamlit's default header background color */
|
20 |
-
|
21 |
-
/* padding
|
22 |
-
/* padding-bottom: 1rem; */
|
23 |
}
|
24 |
|
25 |
-
/*
|
26 |
-
|
27 |
-
/*
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
</style>
|
34 |
""", unsafe_allow_html=True)
|
35 |
|
36 |
-
# --- App Content (will scroll below the
|
37 |
|
38 |
# The logo placed here will likely appear in the sidebar or main body,
|
39 |
-
# not in the
|
40 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
41 |
|
42 |
st.sidebar.header("SBS V2.0 mapper")
|
43 |
st.sidebar.write("(work in progress)")
|
44 |
st.sidebar.text("Demo by JA-RAD")
|
45 |
|
46 |
-
# Note: st.title and st.subheader here will appear *below* the
|
47 |
# as they are part of the main app content flow.
|
48 |
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
|
49 |
st.subheader("Select specific Chapter for quicker results")
|
@@ -62,5 +78,5 @@ pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
|
|
62 |
pg.run()
|
63 |
|
64 |
# Add some extra content to make the page scrollable for testing
|
65 |
-
for i in range(
|
66 |
st.write(f"This is scrollable content line {i}")
|
|
|
1 |
import streamlit as st
|
2 |
+
# No need to import time if not simulating task here
|
3 |
|
4 |
# --- Page Configuration ---
|
5 |
# This sets the title and icon that appear in the default header
|
6 |
st.set_page_config(
|
7 |
+
page_title="SBS V2.0 mapper", # This title will appear in the fixed header
|
8 |
page_icon=":material/keyboard:", # This icon can also appear in the header
|
9 |
layout="wide" # Optional: Use wide layout
|
10 |
)
|
11 |
|
12 |
+
# --- Custom CSS for Fixed Default Header ---
|
13 |
st.markdown("""
|
14 |
<style>
|
15 |
+
/* Make the default Streamlit header fixed at the top */
|
16 |
header {
|
17 |
+
position: fixed; /* Use fixed positioning for viewport-relative stickiness */
|
18 |
+
top: 0; /* Position from the top edge */
|
19 |
+
left: 0; /* Position from the left edge */
|
20 |
+
width: 100%; /* Span the full width of the viewport */
|
21 |
+
z-index: 100; /* Ensure the header is above other content */
|
22 |
background-color: rgb(240, 242, 246); /* Match Streamlit's default header background color */
|
23 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optional: Add a subtle shadow */
|
24 |
+
/* You might need to adjust padding if the default header height changes */
|
|
|
25 |
}
|
26 |
|
27 |
+
/* Add padding to the main content area to prevent it from being hidden behind the fixed header */
|
28 |
+
/* This targets the main container div below the header and sidebar */
|
29 |
+
/* You might need to inspect the Streamlit app's HTML structure in your browser
|
30 |
+
(using developer tools) to find the precise data-testid or class for this div
|
31 |
+
if "stAppViewContainer" or "stVerticalBlock" doesn't work reliably,
|
32 |
+
but stAppViewContainer is a common target. */
|
33 |
+
[data-testid="stAppViewContainer"] {
|
34 |
+
padding-top: 70px; /* Adjust this value to be slightly more than your header's height */
|
35 |
}
|
36 |
+
|
37 |
+
/* Also add padding to the sidebar content */
|
38 |
+
[data-testid="stSidebar"] {
|
39 |
+
padding-top: 70px; /* Use the same padding value as the main content */
|
40 |
+
}
|
41 |
+
|
42 |
+
/* If the layout is 'wide', adjust the padding on the main container */
|
43 |
+
/* This helps keep content aligned if the header has internal padding/margins */
|
44 |
+
.main .block-container {
|
45 |
+
padding-top: 1rem; /* Or match default streamlit content padding */
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
</style>
|
50 |
""", unsafe_allow_html=True)
|
51 |
|
52 |
+
# --- App Content (will scroll below the fixed header) ---
|
53 |
|
54 |
# The logo placed here will likely appear in the sidebar or main body,
|
55 |
+
# not in the fixed default header. Use st.set_page_config for the header icon.
|
56 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
57 |
|
58 |
st.sidebar.header("SBS V2.0 mapper")
|
59 |
st.sidebar.write("(work in progress)")
|
60 |
st.sidebar.text("Demo by JA-RAD")
|
61 |
|
62 |
+
# Note: st.title and st.subheader here will appear *below* the fixed header,
|
63 |
# as they are part of the main app content flow.
|
64 |
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
|
65 |
st.subheader("Select specific Chapter for quicker results")
|
|
|
78 |
pg.run()
|
79 |
|
80 |
# Add some extra content to make the page scrollable for testing
|
81 |
+
for i in range(100): # Increased lines to ensure sufficient scrolling
|
82 |
st.write(f"This is scrollable content line {i}")
|