georad commited on
Commit
e7f3391
·
verified ·
1 Parent(s): 8918a49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -18
app.py CHANGED
@@ -1,34 +1,35 @@
1
  import streamlit as st
2
 
3
- # Custom CSS
4
  st.markdown("""
5
  <style>
6
- .header-container {
 
 
7
  position: fixed;
8
  top: 0;
9
  left: 0;
10
  right: 0;
11
- z-index: 999;
 
12
  background-color: white;
13
- padding: 1rem;
14
- box-shadow: 0 2px 5px rgba(0,0,0,0.1);
15
  }
16
-
17
- /* Add padding to content */
18
- .main .block-container {
19
- padding-top: 7rem;
20
  }
21
- </style>
22
- """, unsafe_allow_html=True)
23
 
24
- # Custom header
25
- with st.container():
26
- st.markdown('<div class="header-container">', unsafe_allow_html=True)
27
- st.title("My App Title")
28
- # Other header elements
29
- st.markdown('</div>', unsafe_allow_html=True)
30
 
31
- # Rest of your app content
 
 
 
32
 
33
  # --- PAGE SETUP ---
34
  type_text_page = st.Page(
 
1
  import streamlit as st
2
 
3
+ # Custom CSS to ensure sticky header in both Streamlit and Hugging Face environments
4
  st.markdown("""
5
  <style>
6
+ /* Target both Streamlit native and Hugging Face iframe embedding */
7
+ /* Make the header sticky */
8
+ header[data-testid="stHeader"] {
9
  position: fixed;
10
  top: 0;
11
  left: 0;
12
  right: 0;
13
+ height: auto;
14
+ z-index: 999990;
15
  background-color: white;
16
+ box-shadow: 0 1px 5px rgba(0,0,0,0.1);
 
17
  }
18
+
19
+ /* For Hugging Face specific iframe handling */
20
+ section.main {
21
+ padding-top: 70px;
22
  }
 
 
23
 
24
+ /* Ensure content doesn't get hidden under the header */
25
+ .block-container {
26
+ padding-top: 1rem;
27
+ }
 
 
28
 
29
+ /* Fix for Hugging Face iframe specific issues */
30
+ iframe body .stApp {
31
+ padding-top: 3rem;
32
+ }
33
 
34
  # --- PAGE SETUP ---
35
  type_text_page = st.Page(