georad commited on
Commit
7b883db
·
verified ·
1 Parent(s): d8197b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -56
app.py CHANGED
@@ -1,78 +1,56 @@
1
  import streamlit as st
2
- import time # Import time for simulating a running task
3
 
4
- # --- Custom CSS for Sticky Header ---
 
 
 
 
 
 
 
 
5
  st.markdown("""
6
  <style>
7
- /* Make the custom header container sticky */
8
- .sticky-header {
9
  position: sticky;
10
- top: 0;
11
- background-color: white; /* Or your preferred header background color */
12
- padding: 10px 0; /* Adjust padding as needed */
13
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optional: Add a subtle shadow */
14
- z-index: 999; /* Ensure the header stays on top */
15
- }
16
-
17
- /* Style for the status indicator */
18
- .status-indicator {
19
- margin-left: 20px; /* Adjust spacing */
20
- font-weight: bold;
21
- }
22
-
23
- .status-running {
24
- color: orange;
25
- }
26
-
27
- .status-complete {
28
- color: green;
29
  }
30
 
31
- .status-error {
32
- color: red;
 
 
 
 
33
  }
 
34
  </style>
35
  """, unsafe_allow_html=True)
36
 
37
- # --- Sticky Header Content ---
38
- # Use a container for the sticky header
39
- header_container = st.container()
40
-
41
- with header_container:
42
- col1, col2 = st.columns([1, 5]) # Adjust column ratios as needed
43
- with col1:
44
- st.logo(image="images/menu_book_60dp_75FBFD.png")
45
- with col2:
46
- st.title("Map descriptions to SBS codes") # Your app title
47
- # Placeholder for the status indicator
48
- status_placeholder = st.empty()
49
 
50
- # Add spacing below the sticky header to prevent content from being hidden
51
- st.markdown("""<div style="height: 120px;"></div>""", unsafe_allow_html=True) # Adjust height based on your header size
 
52
 
53
- # --- Main App Content ---
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
  st.subheader("Select specific Chapter for quicker results")
59
 
60
 
61
- # --- Application Logic (Example with Status Update) ---
62
-
63
- # Function to simulate a long-running task
64
- def run_mapping_process():
65
- status_placeholder.markdown('<span class="status-indicator status-running">Running...</span>', unsafe_allow_html=True)
66
- # Simulate work
67
- time.sleep(3)
68
- # Update status on completion
69
- status_placeholder.markdown('<span class="status-indicator status-complete">Complete</span>', unsafe_allow_html=True)
70
-
71
- # Example of triggering the process (you would integrate this with your actual logic)
72
- if st.button("Start Mapping"):
73
- run_mapping_process()
74
-
75
- # --- Navigation (Keep your existing navigation setup) ---
76
  type_text_page = st.Page(
77
  page="pages/type_text.py",
78
  title="DEMO (work in progress)",
@@ -80,7 +58,9 @@ type_text_page = st.Page(
80
  default=True,
81
  )
82
 
83
- # --- NAVIGATION SETUP ---
84
  pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
85
  pg.run()
86
 
 
 
 
 
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
+ 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 Sticky Default Header ---
12
  st.markdown("""
13
  <style>
14
+ /* Make the default Streamlit header sticky */
15
+ header {
16
  position: sticky;
17
+ top: 0; /* Stick to the top edge */
18
+ z-index: 100; /* Ensure the header is above other content */
19
+ background-color: rgb(240, 242, 246); /* Match Streamlit's default header background color */
20
+ /* Add padding if needed, though sticky often works well with default layout */
21
+ /* padding-top: 1rem; */
22
+ /* padding-bottom: 1rem; */
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
+ /* Optional: Add some padding to the top of the main content
26
+ so it doesn't start hidden behind the sticky header */
27
+ /* This might be handled automatically by position: sticky, but can help if needed */
28
+ /*
29
+ .stApp > div:first-child {
30
+ padding-top: XXpx; // Replace XX with the height of your header
31
  }
32
+ */
33
  </style>
34
  """, unsafe_allow_html=True)
35
 
36
+ # --- App Content (will scroll below the sticky header) ---
 
 
 
 
 
 
 
 
 
 
 
37
 
38
+ # The logo placed here will likely appear in the sidebar or main body,
39
+ # not in the sticky default header. Use st.set_page_config for the header icon.
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 sticky header,
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")
50
 
51
 
52
+ # --- NAVIGATION SETUP ---
53
+ # Keep your existing navigation setup
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  type_text_page = st.Page(
55
  page="pages/type_text.py",
56
  title="DEMO (work in progress)",
 
58
  default=True,
59
  )
60
 
 
61
  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(50):
66
+ st.write(f"This is scrollable content line {i}")