Update app_test_header.py
Browse files- app_test_header.py +12 -50
app_test_header.py
CHANGED
@@ -1,57 +1,19 @@
|
|
1 |
-
import os
|
2 |
import streamlit as st
|
3 |
import torch
|
4 |
-
import
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
return 'cuda' if torch.cuda.is_available() else 'cpu'
|
8 |
-
device = get_device_map() # 'cpu'
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
/* Making the Streamlit header sticky */
|
13 |
-
{HEADER_SELECTOR} {{
|
14 |
-
position: -webkit-sticky !important; /* For Safari */
|
15 |
-
position: sticky !important;
|
16 |
-
top: 0 !important;
|
17 |
-
z-index: 9999 !important; /* Very high z-index */
|
18 |
-
background-color: #90EE90 !important; /* Or your app's header background color */
|
19 |
-
/* Add a subtle shadow to make it feel more distinct when content scrolls under */
|
20 |
-
/* box-shadow: 0 2px 4px -1px rgba(0,0,0,0.1); */
|
21 |
-
/*.reportview-container .main .block-container{{ */
|
22 |
-
/* padding-top: 0rem; */
|
23 |
-
/* }} */
|
24 |
-
}}
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
with st.spinner("In progress..."):
|
29 |
-
hf_token = os.getenv('HF_TOKEN')
|
30 |
-
df_chapters = pd.read_csv("SBS_V2_0/Chapter_Index_Rows_with_total.csv")
|
31 |
-
st.image("images/SBS_Chapter_Index.png", use_container_width=True)
|
32 |
-
st.subheader("Select specific Chapter for quicker results")
|
33 |
-
st.write(df_chapters.head())
|
34 |
-
|
35 |
-
/* Adding padding to the main content area to prevent overlap with the sticky header */
|
36 |
-
{MAIN_CONTENT_SELECTOR} {{
|
37 |
-
padding-top: 10px !important; /* {HEADER_HEIGHT} !important; */
|
38 |
-
/* background-color: yellow !important; */
|
39 |
-
/* border-style: solid !important; */
|
40 |
-
/* border-color: red !important; */
|
41 |
-
}}
|
42 |
-
|
43 |
-
/* Optional: If your app is set to wide mode and the header isn't spanning full width */
|
44 |
-
/* This might be needed if the sticky positioning affects its width calculation. */
|
45 |
-
/*
|
46 |
-
#{HEADER_SELECTOR} {{
|
47 |
-
# width: 100% !important;
|
48 |
-
#}}
|
49 |
-
#*/
|
50 |
-
</style>
|
51 |
-
"""
|
52 |
-
|
53 |
|
54 |
if __name__ == "__main__":
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import torch
|
3 |
+
import uuid
|
4 |
+
import nest_asyncio
|
5 |
+
import asyncio
|
6 |
|
7 |
+
torch.classes.__path__ = []
|
|
|
|
|
8 |
|
9 |
+
if 'device_id' not in st.session_state:
|
10 |
+
st.session_state.device_id = str(uuid.uuid4())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
if "feedback_key" not in st.session_state:
|
13 |
+
st.session_state.feedback_key = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
+
st.set_page_config(page_title="Test Sticky Header", layout="wide")
|
17 |
+
|
18 |
+
nest_asyncio.apply()
|
19 |
+
asyncio.run(main())
|