Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,57 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Remove any previous custom CSS styles
|
4 |
-
#
|
5 |
|
6 |
-
#
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
#
|
10 |
-
|
|
|
|
|
|
|
|
|
11 |
st.markdown("""
|
12 |
-
<div
|
13 |
<h1>Map descriptions to SBS codes with Sentence Transformer + Reasoning</h1>
|
14 |
<h3>Select specific Chapter for quicker results</h3>
|
15 |
</div>
|
16 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
|
21 |
# Rest of your app works as normal
|
22 |
st.sidebar.header("SBS V2.0 mapper")
|
@@ -31,4 +66,4 @@ type_text_page = st.Page(
|
|
31 |
default=True,)
|
32 |
|
33 |
pg = st.navigation(pages=[type_text_page])
|
34 |
-
pg.run()
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Remove any previous custom CSS styles
|
4 |
+
# Create a custom sticky header using Streamlit components
|
5 |
|
6 |
+
# Custom CSS only for basic styling, not position control
|
7 |
+
st.markdown("""
|
8 |
+
<style>
|
9 |
+
/* Basic styling for our custom header */
|
10 |
+
.custom-sticky-header {
|
11 |
+
background-color: #90EE90;
|
12 |
+
padding: 10px 15px;
|
13 |
+
border-bottom: 1px solid #ccc;
|
14 |
+
margin-bottom: 20px;
|
15 |
+
}
|
16 |
+
|
17 |
+
/* Hide the default Streamlit header */
|
18 |
+
[data-testid="stHeader"] {
|
19 |
+
visibility: hidden;
|
20 |
+
height: 0;
|
21 |
+
}
|
22 |
+
|
23 |
+
/* Ensure our custom header stays at the top */
|
24 |
+
[data-testid="stVerticalBlock"] > div:first-child {
|
25 |
+
position: sticky !important;
|
26 |
+
top: 0 !important;
|
27 |
+
background-color: white !important;
|
28 |
+
z-index: 999 !important;
|
29 |
+
}
|
30 |
+
</style>
|
31 |
+
""", unsafe_allow_html=True)
|
32 |
|
33 |
+
# Create a placeholder for the sticky header at the very top of the app
|
34 |
+
# This has to be the first element in your app
|
35 |
+
header_container = st.container()
|
36 |
+
|
37 |
+
# Use the container to create a custom header
|
38 |
+
with header_container:
|
39 |
st.markdown("""
|
40 |
+
<div class="custom-sticky-header">
|
41 |
<h1>Map descriptions to SBS codes with Sentence Transformer + Reasoning</h1>
|
42 |
<h3>Select specific Chapter for quicker results</h3>
|
43 |
</div>
|
44 |
""", unsafe_allow_html=True)
|
45 |
+
|
46 |
+
# Add the image directly in the header
|
47 |
+
try:
|
48 |
+
st.image("images/menu_book_60dp_75FBFD.png", width=100)
|
49 |
+
except:
|
50 |
+
# In case the image path doesn't work
|
51 |
+
st.write("Logo image")
|
52 |
|
53 |
+
# Add a small spacer
|
54 |
+
st.write("")
|
55 |
|
56 |
# Rest of your app works as normal
|
57 |
st.sidebar.header("SBS V2.0 mapper")
|
|
|
66 |
default=True,)
|
67 |
|
68 |
pg = st.navigation(pages=[type_text_page])
|
69 |
+
pg.run()
|