georad commited on
Commit
f93ba69
·
verified ·
1 Parent(s): e97685c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +68 -20
app.py CHANGED
@@ -1,43 +1,91 @@
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
- # Add spacing to prevent content from being hidden under the fixed header
18
- st.markdown(
19
- """
20
- <div style="height: 100px;"></div>
21
- """,
22
- unsafe_allow_html=True
23
- )
24
 
25
- # Rest of the app
26
- # Sidebar content
27
  st.sidebar.header("SBS V2.0 mapper")
28
  st.sidebar.write("(work in progress)")
29
  st.sidebar.text("Demo by JA-RAD")
30
- st.title("Map descriptions to SBS codes with Sentence Transformer + Reasoning")
31
  st.subheader("Select specific Chapter for quicker results")
32
- st.logo(image="images/menu_book_60dp_75FBFD.png")
33
 
34
- # Page setup - moved after the custom header
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  type_text_page = st.Page(
36
  page="pages/type_text.py",
37
  title="DEMO (work in progress)",
38
  icon=":material/keyboard:",
39
- default=True,)
 
40
 
41
  # --- NAVIGATION SETUP ---
42
  pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
43
  pg.run()
 
 
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
+ /* Hide the default Streamlit header */
8
+ header {
9
+ display: none !important;
10
+ }
11
+
12
+ /* Make the custom header container sticky */
13
+ .sticky-header {
14
+ position: sticky;
15
+ top: 0;
16
+ background-color: white; /* Or your preferred header background color */
17
+ padding: 10px 0; /* Adjust padding as needed */
18
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optional: Add a subtle shadow */
19
+ z-index: 999; /* Ensure the header stays on top */
20
+ }
21
+
22
+ /* Style for the status indicator */
23
+ .status-indicator {
24
+ margin-left: 20px; /* Adjust spacing */
25
+ font-weight: bold;
26
+ }
27
+
28
+ .status-running {
29
+ color: orange;
30
+ }
31
+
32
+ .status-complete {
33
+ color: green;
34
+ }
35
+
36
+ .status-error {
37
+ color: red;
38
+ }
39
  </style>
40
  """, unsafe_allow_html=True)
41
 
42
+ # --- Sticky Header Content ---
43
+ # Use a container for the sticky header
44
+ header_container = st.container()
45
 
46
+ with header_container:
47
+ col1, col2 = st.columns([1, 5]) # Adjust column ratios as needed
48
+ with col1:
49
+ st.logo(image="images/menu_book_60dp_75FBFD.png")
50
+ with col2:
51
+ st.title("Map descriptions to SBS codes") # Your app title
52
+ # Placeholder for the status indicator
53
+ status_placeholder = st.empty()
54
 
55
+ # Add spacing below the sticky header to prevent content from being hidden
56
+ st.markdown("""<div style="height: 120px;"></div>""", unsafe_allow_html=True) # Adjust height based on your header size
 
 
 
 
 
57
 
58
+ # --- Main App 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
+
63
  st.subheader("Select specific Chapter for quicker results")
 
64
 
65
+
66
+ # --- Application Logic (Example with Status Update) ---
67
+
68
+ # Function to simulate a long-running task
69
+ def run_mapping_process():
70
+ status_placeholder.markdown('<span class="status-indicator status-running">Running...</span>', unsafe_allow_html=True)
71
+ # Simulate work
72
+ time.sleep(3)
73
+ # Update status on completion
74
+ status_placeholder.markdown('<span class="status-indicator status-complete">Complete</span>', unsafe_allow_html=True)
75
+
76
+ # Example of triggering the process (you would integrate this with your actual logic)
77
+ if st.button("Start Mapping"):
78
+ run_mapping_process()
79
+
80
+ # --- Navigation (Keep your existing navigation setup) ---
81
  type_text_page = st.Page(
82
  page="pages/type_text.py",
83
  title="DEMO (work in progress)",
84
  icon=":material/keyboard:",
85
+ default=True,
86
+ )
87
 
88
  # --- NAVIGATION SETUP ---
89
  pg = st.navigation(pages=[type_text_page]) # WITHOUT SECTIONS
90
  pg.run()
91
+