Update app.py
Browse files
app.py
CHANGED
@@ -1,66 +1,63 @@
|
|
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
|
8 |
-
|
|
|
9 |
layout="wide" # Optional: Use wide layout
|
10 |
)
|
11 |
|
12 |
-
# --- Custom CSS for
|
13 |
st.markdown("""
|
14 |
<style>
|
15 |
-
/* Make the default Streamlit header
|
16 |
header {
|
17 |
-
position:
|
18 |
-
top:
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
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
|
28 |
-
/* This targets the main container div
|
29 |
-
/*
|
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:
|
35 |
}
|
36 |
|
37 |
-
/*
|
38 |
[data-testid="stSidebar"] {
|
39 |
-
padding-top:
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
|
44 |
.main .block-container {
|
45 |
-
padding-top: 1rem; /*
|
46 |
}
|
47 |
|
48 |
-
|
49 |
</style>
|
50 |
""", unsafe_allow_html=True)
|
51 |
|
52 |
-
# --- App Content (will scroll below the
|
53 |
|
54 |
-
# The logo
|
55 |
-
# not in the
|
|
|
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
|
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")
|
66 |
|
@@ -70,7 +67,7 @@ st.subheader("Select specific Chapter for quicker results")
|
|
70 |
type_text_page = st.Page(
|
71 |
page="pages/type_text.py",
|
72 |
title="DEMO (work in progress)",
|
73 |
-
icon=":material/keyboard:",
|
74 |
default=True,
|
75 |
)
|
76 |
|
@@ -78,5 +75,6 @@ pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
|
|
78 |
pg.run()
|
79 |
|
80 |
# Add some extra content to make the page scrollable for testing
|
81 |
-
|
|
|
82 |
st.write(f"This is scrollable content line {i}")
|
|
|
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 sticky header
|
7 |
+
# Use the logo image here if you want it in the header (optional)
|
8 |
+
# page_icon="images/menu_book_60dp_75FBFD.png",
|
9 |
layout="wide" # Optional: Use wide layout
|
10 |
)
|
11 |
|
12 |
+
# --- Custom CSS for Sticky Default Header ---
|
13 |
st.markdown("""
|
14 |
<style>
|
15 |
+
/* Make the default Streamlit header sticky */
|
16 |
header {
|
17 |
+
position: sticky; /* Use sticky positioning */
|
18 |
+
top: 0px; /* Stick to the top edge */
|
19 |
+
z-index: 999; /* Ensure the header is always on top */
|
20 |
+
background-color: rgb(255, 255, 255); /* Use white background or match Streamlit's default header color */
|
21 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Add shadow for better visibility */
|
22 |
+
/* Adjust padding/height if needed, but default usually works well with sticky */
|
|
|
|
|
23 |
}
|
24 |
|
25 |
+
/* Add padding to the main content area to prevent it from starting behind the sticky header */
|
26 |
+
/* This targets the main container div where your app content and pages are rendered */
|
27 |
+
/* The exact value might need slight adjustment based on the header's actual height */
|
|
|
|
|
|
|
28 |
[data-testid="stAppViewContainer"] {
|
29 |
+
padding-top: 60px; /* Estimate header height (~60px). Adjust if needed. */
|
30 |
}
|
31 |
|
32 |
+
/* Adjust padding for the sidebar content as well */
|
33 |
[data-testid="stSidebar"] {
|
34 |
+
padding-top: 60px; /* Use the same padding value as the main content */
|
35 |
}
|
36 |
|
37 |
+
/* Ensure the main content block within the container also has correct top padding */
|
38 |
+
/* This might be necessary for correct spacing below the header */
|
39 |
.main .block-container {
|
40 |
+
padding-top: 1rem; /* Keep or adjust default Streamlit content padding */
|
41 |
}
|
42 |
|
|
|
43 |
</style>
|
44 |
""", unsafe_allow_html=True)
|
45 |
|
46 |
+
# --- App Content (will scroll below the sticky header) ---
|
47 |
|
48 |
+
# The st.logo call here will place the logo in the sidebar or main body,
|
49 |
+
# not in the sticky default header. If you want a logo in the header,
|
50 |
+
# use the page_icon parameter in st.set_page_config above.
|
51 |
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
52 |
|
53 |
+
|
54 |
st.sidebar.header("SBS V2.0 mapper")
|
55 |
st.sidebar.write("(work in progress)")
|
56 |
st.sidebar.text("Demo by JA-RAD")
|
57 |
|
58 |
+
# Note: st.title and st.subheader here will appear *below* the sticky header,
|
59 |
+
# as they are part of the main app content flow. The title in the sticky header
|
60 |
+
# comes from st.set_page_config.
|
61 |
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
|
62 |
st.subheader("Select specific Chapter for quicker results")
|
63 |
|
|
|
67 |
type_text_page = st.Page(
|
68 |
page="pages/type_text.py",
|
69 |
title="DEMO (work in progress)",
|
70 |
+
icon=":material/keyboard:", # This icon can appear in the tab/bookmark
|
71 |
default=True,
|
72 |
)
|
73 |
|
|
|
75 |
pg.run()
|
76 |
|
77 |
# Add some extra content to make the page scrollable for testing
|
78 |
+
# Remove this loop in your final application if you have enough content already
|
79 |
+
for i in range(100):
|
80 |
st.write(f"This is scrollable content line {i}")
|