Roni Goldshmidt commited on
Commit
4e1097d
·
1 Parent(s): 87b7870

Initial leaderboard setup

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +14 -17
  2. app.py +14 -17
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -35,7 +35,7 @@ st.markdown("""
35
  """, unsafe_allow_html=True)
36
 
37
  # Header
38
- col1, col2 = st.columns([0.15, 0.85])
39
  with col1:
40
  st.image("nexar_logo.png", width=600)
41
  with col2:
@@ -221,30 +221,27 @@ with tab2:
221
  # Get the consistent color for this model
222
  color = model_colors[model]
223
 
224
- # Store toggle state in session state with unique key
225
  toggle_key = f"toggle_{model}"
226
  if toggle_key not in st.session_state:
227
  st.session_state[toggle_key] = True
228
-
229
- # Create the checkbox with colored text
230
- st.session_state[toggle_key] = container.checkbox(
231
- f"⬤ {model}",
232
- value=st.session_state[toggle_key],
233
- key=f"model_toggle_{model}"
234
- )
235
 
236
- # Add colored style to the checkbox
237
  container.markdown(
238
  f"""
239
- <style>
240
- [data-testid="stCheckbox"] label p {{
241
- color: {color};
242
- font-weight: bold;
243
- }}
244
- </style>
245
- """,
246
  unsafe_allow_html=True
247
  )
 
 
 
 
 
 
 
248
 
249
  # Individual Precision-Recall plots for each class
250
  unique_classes = class_data['Class'].unique()
 
35
  """, unsafe_allow_html=True)
36
 
37
  # Header
38
+ col1, col2 = st.columns([0.16, 0.84])
39
  with col1:
40
  st.image("nexar_logo.png", width=600)
41
  with col2:
 
221
  # Get the consistent color for this model
222
  color = model_colors[model]
223
 
224
+ # Initialize toggle state if needed
225
  toggle_key = f"toggle_{model}"
226
  if toggle_key not in st.session_state:
227
  st.session_state[toggle_key] = True
 
 
 
 
 
 
 
228
 
229
+ # Create colored legend item with HTML
230
  container.markdown(
231
  f"""
232
+ <div style='display: flex; align-items: center; margin-bottom: -40px; pointer-events: none;'>
233
+ <span style='display: inline-block; width: 12px; height: 12px; background-color: {color}; border-radius: 50%; margin-right: 8px;'></span>
234
+ </div>
235
+ """,
 
 
 
236
  unsafe_allow_html=True
237
  )
238
+
239
+ # Create the checkbox without reassigning to session state
240
+ container.checkbox(
241
+ f" {model}", # Add some spacing to account for the circle
242
+ value=st.session_state[toggle_key],
243
+ key=toggle_key # Use toggle_key directly as the key
244
+ )
245
 
246
  # Individual Precision-Recall plots for each class
247
  unique_classes = class_data['Class'].unique()
app.py CHANGED
@@ -35,7 +35,7 @@ st.markdown("""
35
  """, unsafe_allow_html=True)
36
 
37
  # Header
38
- col1, col2 = st.columns([0.15, 0.85])
39
  with col1:
40
  st.image("nexar_logo.png", width=600)
41
  with col2:
@@ -221,30 +221,27 @@ with tab2:
221
  # Get the consistent color for this model
222
  color = model_colors[model]
223
 
224
- # Store toggle state in session state with unique key
225
  toggle_key = f"toggle_{model}"
226
  if toggle_key not in st.session_state:
227
  st.session_state[toggle_key] = True
228
-
229
- # Create the checkbox with colored text
230
- st.session_state[toggle_key] = container.checkbox(
231
- f"⬤ {model}",
232
- value=st.session_state[toggle_key],
233
- key=f"model_toggle_{model}"
234
- )
235
 
236
- # Add colored style to the checkbox
237
  container.markdown(
238
  f"""
239
- <style>
240
- [data-testid="stCheckbox"] label p {{
241
- color: {color};
242
- font-weight: bold;
243
- }}
244
- </style>
245
- """,
246
  unsafe_allow_html=True
247
  )
 
 
 
 
 
 
 
248
 
249
  # Individual Precision-Recall plots for each class
250
  unique_classes = class_data['Class'].unique()
 
35
  """, unsafe_allow_html=True)
36
 
37
  # Header
38
+ col1, col2 = st.columns([0.16, 0.84])
39
  with col1:
40
  st.image("nexar_logo.png", width=600)
41
  with col2:
 
221
  # Get the consistent color for this model
222
  color = model_colors[model]
223
 
224
+ # Initialize toggle state if needed
225
  toggle_key = f"toggle_{model}"
226
  if toggle_key not in st.session_state:
227
  st.session_state[toggle_key] = True
 
 
 
 
 
 
 
228
 
229
+ # Create colored legend item with HTML
230
  container.markdown(
231
  f"""
232
+ <div style='display: flex; align-items: center; margin-bottom: -40px; pointer-events: none;'>
233
+ <span style='display: inline-block; width: 12px; height: 12px; background-color: {color}; border-radius: 50%; margin-right: 8px;'></span>
234
+ </div>
235
+ """,
 
 
 
236
  unsafe_allow_html=True
237
  )
238
+
239
+ # Create the checkbox without reassigning to session state
240
+ container.checkbox(
241
+ f" {model}", # Add some spacing to account for the circle
242
+ value=st.session_state[toggle_key],
243
+ key=toggle_key # Use toggle_key directly as the key
244
+ )
245
 
246
  # Individual Precision-Recall plots for each class
247
  unique_classes = class_data['Class'].unique()