Update app.py
Browse files
app.py
CHANGED
@@ -1,99 +1,75 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
#
|
4 |
-
custom_css = """
|
5 |
-
<style>
|
6 |
-
div.block-container {
|
7 |
-
padding-top: 1rem;
|
8 |
-
}
|
9 |
-
|
10 |
-
div[data-testid="stDecoratedAppViewContainer"] > div:first-child {
|
11 |
-
position: sticky !important;
|
12 |
-
top: 0 !important;
|
13 |
-
background-color: white;
|
14 |
-
z-index: 999;
|
15 |
-
padding: 0px !important;
|
16 |
-
}
|
17 |
-
|
18 |
-
.custom-header {
|
19 |
-
background-color: #90EE90;
|
20 |
-
padding: 1rem;
|
21 |
-
border-bottom: 1px solid #ddd;
|
22 |
-
width: 100%;
|
23 |
-
}
|
24 |
-
|
25 |
-
header[data-testid="stHeader"] {
|
26 |
-
display: none;
|
27 |
-
}
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
</style>
|
33 |
-
"""
|
|
|
|
|
34 |
|
35 |
-
#
|
36 |
-
st.
|
37 |
|
38 |
-
#
|
39 |
-
|
40 |
-
with
|
41 |
-
st.markdown(
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
-
# Add
|
60 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
#
|
|
|
63 |
st.sidebar.header("SBS V2.0 mapper")
|
64 |
st.sidebar.write("(work in progress)")
|
65 |
st.sidebar.text("Demo by JA-RAD")
|
|
|
|
|
|
|
66 |
|
67 |
-
# Page setup
|
68 |
-
type_text_page = st.Page(
|
69 |
-
page="pages/type_text.py",
|
70 |
-
title="DEMO (work in progress)",
|
71 |
-
icon=":material/keyboard:",
|
72 |
-
default=True,)
|
73 |
-
|
74 |
-
# Navigation
|
75 |
-
pg = st.navigation(pages=[type_text_page])
|
76 |
-
pg.run()
|
77 |
-
|
78 |
-
# Inject CSS and JS as early as possible in your app
|
79 |
-
st.markdown(custom_css, unsafe_allow_html=True)
|
80 |
-
st.markdown(js_fix, unsafe_allow_html=True)
|
81 |
-
|
82 |
-
# --- PAGE SETUP ---
|
83 |
type_text_page = st.Page(
|
84 |
page="pages/type_text.py",
|
85 |
title="DEMO (work in progress)",
|
86 |
icon=":material/keyboard:",
|
87 |
default=True,)
|
88 |
|
89 |
-
# --- Your Streamlit App ---
|
90 |
-
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
|
91 |
-
st.subheader("Select specific Chapter for quicker results")
|
92 |
-
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
93 |
-
st.sidebar.header("SBS V2.0 mapper")
|
94 |
-
st.sidebar.write("(work in progress)")
|
95 |
-
st.sidebar.text("Demo by JA-RAD")
|
96 |
-
|
97 |
# --- NAVIGATION SETUP ---
|
98 |
pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
|
99 |
pg.run()
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Alternative approach: Use Streamlit's native components with minimal CSS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
# First, let's hide the default header with minimal CSS
|
6 |
+
st.markdown("""
|
7 |
+
<style>
|
8 |
+
header {display: none !important;}
|
9 |
</style>
|
10 |
+
""", unsafe_allow_html=True)
|
11 |
+
|
12 |
+
# Now create a completely custom header using Streamlit elements
|
13 |
|
14 |
+
# Create a container at the top of the app
|
15 |
+
header = st.container()
|
16 |
|
17 |
+
# Use the container for the header
|
18 |
+
with header:
|
19 |
+
# Apply background color with markdown
|
20 |
+
st.markdown(
|
21 |
+
"""
|
22 |
+
<div style="
|
23 |
+
background-color: #90EE90;
|
24 |
+
padding: 10px;
|
25 |
+
margin-bottom: 10px;
|
26 |
+
border-bottom: 1px solid #ddd;
|
27 |
+
position: fixed;
|
28 |
+
top: 0;
|
29 |
+
left: 0;
|
30 |
+
right: 0;
|
31 |
+
z-index: 9999;
|
32 |
+
width: 100%;
|
33 |
+
">
|
34 |
+
<div style="display: flex; align-items: center;">
|
35 |
+
<div style="flex: 0 0 60px;">
|
36 |
+
<img src="https://raw.githubusercontent.com/streamlit/streamlit/master/lib/streamlit/static/favicon.png" width="50"
|
37 |
+
alt="Logo" style="vertical-align: middle;">
|
38 |
+
</div>
|
39 |
+
<div style="flex-grow: 1;">
|
40 |
+
<h2 style="margin: 0; padding: 0;">Map descriptions to SBS codes with Sentence Transformer + Reasoning</h2>
|
41 |
+
<p style="margin: 0; padding: 0;">Select specific Chapter for quicker results</p>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
""",
|
46 |
+
unsafe_allow_html=True
|
47 |
+
)
|
48 |
|
49 |
+
# Add spacing to prevent content from being hidden under the fixed header
|
50 |
+
st.markdown(
|
51 |
+
"""
|
52 |
+
<div style="height: 100px;"></div>
|
53 |
+
""",
|
54 |
+
unsafe_allow_html=True
|
55 |
+
)
|
56 |
|
57 |
+
# Rest of the app
|
58 |
+
# Sidebar content
|
59 |
st.sidebar.header("SBS V2.0 mapper")
|
60 |
st.sidebar.write("(work in progress)")
|
61 |
st.sidebar.text("Demo by JA-RAD")
|
62 |
+
st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
|
63 |
+
st.subheader("Select specific Chapter for quicker results")
|
64 |
+
st.logo(image="images/menu_book_60dp_75FBFD.png")
|
65 |
|
66 |
+
# Page setup - moved after the custom header
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
type_text_page = st.Page(
|
68 |
page="pages/type_text.py",
|
69 |
title="DEMO (work in progress)",
|
70 |
icon=":material/keyboard:",
|
71 |
default=True,)
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
# --- NAVIGATION SETUP ---
|
74 |
pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
|
75 |
pg.run()
|