Spaces:
Running
Running
feat: Add parameter to control sidebar visibility
#3
by
SmileXing
- opened
- app/backend/constant.py +2 -1
- app/backend/data_page.py +26 -1
app/backend/constant.py
CHANGED
@@ -79,11 +79,12 @@ LEADERBOARD_ICON_MAP = {
|
|
79 |
"Healthcare": "π₯",
|
80 |
"Finance": "π°",
|
81 |
"French": "π«π·",
|
|
|
82 |
|
83 |
}
|
84 |
|
85 |
-
|
86 |
USERNAME = "embedding-benchmark"
|
87 |
SPACENAME = "RTEB"
|
|
|
88 |
# https://{UserName}-{SpaceName}.hf.space/
|
89 |
BASE_URL = f"https://{USERNAME}-{SPACENAME}.hf.space/"
|
|
|
79 |
"Healthcare": "π₯",
|
80 |
"Finance": "π°",
|
81 |
"French": "π«π·",
|
82 |
+
"Japanese": "π―π΅",
|
83 |
|
84 |
}
|
85 |
|
|
|
86 |
USERNAME = "embedding-benchmark"
|
87 |
SPACENAME = "RTEB"
|
88 |
+
|
89 |
# https://{UserName}-{SpaceName}.hf.space/
|
90 |
BASE_URL = f"https://{USERNAME}-{SPACENAME}.hf.space/"
|
app/backend/data_page.py
CHANGED
@@ -53,17 +53,42 @@ def get_column_state():
|
|
53 |
get column state from url
|
54 |
"""
|
55 |
query_params = st.query_params.get("grid_state", None)
|
|
|
56 |
if query_params:
|
57 |
grid_state = decompress_msgpack(query_params)
|
58 |
st.session_state.grid_state = grid_state
|
59 |
-
|
|
|
60 |
return None
|
61 |
|
62 |
|
63 |
def render_page(group_name):
|
64 |
grid_state = st.session_state.get("grid_state", {})
|
|
|
65 |
get_column_state()
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
# Add theme color and grid styles
|
68 |
st.title("Retrieval Embedding Benchmark (RTEB)")
|
69 |
st.markdown("""
|
|
|
53 |
get column state from url
|
54 |
"""
|
55 |
query_params = st.query_params.get("grid_state", None)
|
56 |
+
sider_bar_hidden = st.query_params.get("sider_bar_hidden","False")
|
57 |
if query_params:
|
58 |
grid_state = decompress_msgpack(query_params)
|
59 |
st.session_state.grid_state = grid_state
|
60 |
+
if sider_bar_hidden.upper() == 'FALSE':
|
61 |
+
st.session_state.sider_bar_hidden = False
|
62 |
return None
|
63 |
|
64 |
|
65 |
def render_page(group_name):
|
66 |
grid_state = st.session_state.get("grid_state", {})
|
67 |
+
st.session_state.sider_bar_hidden = True
|
68 |
get_column_state()
|
69 |
|
70 |
+
if st.session_state.sider_bar_hidden:
|
71 |
+
st.markdown("""
|
72 |
+
<style>
|
73 |
+
[data-testid="stSidebar"] {
|
74 |
+
display: none !important;
|
75 |
+
}
|
76 |
+
[data-testid="stSidebarNav"] {
|
77 |
+
display: none !important;
|
78 |
+
}
|
79 |
+
|
80 |
+
[data-testid="stBaseButton-headerNoPadding"] {
|
81 |
+
display: none !important;
|
82 |
+
}
|
83 |
+
|
84 |
+
h1#retrieval-embedding-benchmark-rteb {
|
85 |
+
text-align: center;
|
86 |
+
}
|
87 |
+
|
88 |
+
</style>
|
89 |
+
""", unsafe_allow_html=True)
|
90 |
+
|
91 |
+
|
92 |
# Add theme color and grid styles
|
93 |
st.title("Retrieval Embedding Benchmark (RTEB)")
|
94 |
st.markdown("""
|