Roni Goldshmidt
commited on
Commit
·
5ec6b1b
1
Parent(s):
4150653
Initial leaderboard setup
Browse files- .ipynb_checkpoints/app-checkpoint.py +16 -21
- app.py +16 -21
.ipynb_checkpoints/app-checkpoint.py
CHANGED
@@ -181,40 +181,35 @@ with tab2:
|
|
181 |
default=st.session_state.combined_df['Model'].unique()
|
182 |
)
|
183 |
|
|
|
|
|
|
|
|
|
184 |
class_data = st.session_state.combined_df[
|
185 |
(st.session_state.combined_df['Category'] == selected_category) &
|
186 |
(~st.session_state.combined_df['Class'].str.contains('Overall')) &
|
187 |
(st.session_state.combined_df['Model'].isin(selected_models))
|
188 |
]
|
189 |
|
190 |
-
# Bar chart
|
191 |
fig = px.bar(
|
192 |
class_data,
|
193 |
x='Class',
|
194 |
y=selected_metric,
|
195 |
color='Model',
|
196 |
barmode='group',
|
197 |
-
title=f'{selected_metric} by Class for {selected_category}'
|
|
|
198 |
)
|
199 |
st.plotly_chart(fig, use_container_width=True)
|
200 |
|
201 |
-
# Create a shared legend container
|
202 |
-
legend_data = []
|
203 |
-
for i, model in enumerate(selected_models):
|
204 |
-
legend_data.append({
|
205 |
-
'Model': model,
|
206 |
-
'Visible': True,
|
207 |
-
'Index': i
|
208 |
-
})
|
209 |
-
legend_df = pd.DataFrame(legend_data)
|
210 |
-
|
211 |
-
# Create toggles for models using st.columns
|
212 |
-
st.markdown("### Select Models to Display:")
|
213 |
-
|
214 |
# Calculate how many columns we need (aim for about 4-5 models per row)
|
215 |
models_per_row = 4
|
216 |
num_rows = (len(selected_models) + models_per_row - 1) // models_per_row
|
217 |
|
|
|
|
|
|
|
218 |
for row in range(num_rows):
|
219 |
cols = st.columns(models_per_row)
|
220 |
for col_idx in range(models_per_row):
|
@@ -223,9 +218,8 @@ with tab2:
|
|
223 |
model = selected_models[model_idx]
|
224 |
container = cols[col_idx].container()
|
225 |
|
226 |
-
# Get
|
227 |
-
|
228 |
-
color = plotly_colors[model_idx % len(plotly_colors)]
|
229 |
|
230 |
# Store toggle state in session state with unique key
|
231 |
toggle_key = f"toggle_{model}"
|
@@ -234,12 +228,12 @@ with tab2:
|
|
234 |
|
235 |
# Create the checkbox with colored text
|
236 |
st.session_state[toggle_key] = container.checkbox(
|
237 |
-
f"⬤ {model}",
|
238 |
value=st.session_state[toggle_key],
|
239 |
key=f"model_toggle_{model}"
|
240 |
)
|
241 |
|
242 |
-
# Add colored style to the
|
243 |
container.markdown(
|
244 |
f"""
|
245 |
<style>
|
@@ -282,7 +276,8 @@ with tab2:
|
|
282 |
y='Recall',
|
283 |
color='Model',
|
284 |
title=f'Precision vs Recall: {current_class}',
|
285 |
-
height=300
|
|
|
286 |
)
|
287 |
|
288 |
# Update layout for better visibility
|
|
|
181 |
default=st.session_state.combined_df['Model'].unique()
|
182 |
)
|
183 |
|
184 |
+
# Create a consistent color mapping for all models
|
185 |
+
plotly_colors = ['#636EFA', '#EF553B', '#00CC96', '#AB63FA', '#FFA15A', '#19D3F3', '#FF6692', '#B6E880', '#FF97FF', '#FECB52']
|
186 |
+
model_colors = {model: plotly_colors[i % len(plotly_colors)] for i, model in enumerate(sorted(st.session_state.combined_df['Model'].unique()))}
|
187 |
+
|
188 |
class_data = st.session_state.combined_df[
|
189 |
(st.session_state.combined_df['Category'] == selected_category) &
|
190 |
(~st.session_state.combined_df['Class'].str.contains('Overall')) &
|
191 |
(st.session_state.combined_df['Model'].isin(selected_models))
|
192 |
]
|
193 |
|
194 |
+
# Bar chart with consistent colors
|
195 |
fig = px.bar(
|
196 |
class_data,
|
197 |
x='Class',
|
198 |
y=selected_metric,
|
199 |
color='Model',
|
200 |
barmode='group',
|
201 |
+
title=f'{selected_metric} by Class for {selected_category}',
|
202 |
+
color_discrete_map=model_colors
|
203 |
)
|
204 |
st.plotly_chart(fig, use_container_width=True)
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
# Calculate how many columns we need (aim for about 4-5 models per row)
|
207 |
models_per_row = 4
|
208 |
num_rows = (len(selected_models) + models_per_row - 1) // models_per_row
|
209 |
|
210 |
+
st.markdown("### Select Models to Display:")
|
211 |
+
|
212 |
+
# Create toggles for models using st.columns
|
213 |
for row in range(num_rows):
|
214 |
cols = st.columns(models_per_row)
|
215 |
for col_idx in range(models_per_row):
|
|
|
218 |
model = selected_models[model_idx]
|
219 |
container = cols[col_idx].container()
|
220 |
|
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}"
|
|
|
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>
|
|
|
276 |
y='Recall',
|
277 |
color='Model',
|
278 |
title=f'Precision vs Recall: {current_class}',
|
279 |
+
height=300,
|
280 |
+
color_discrete_map=model_colors # Use consistent colors
|
281 |
)
|
282 |
|
283 |
# Update layout for better visibility
|
app.py
CHANGED
@@ -181,40 +181,35 @@ with tab2:
|
|
181 |
default=st.session_state.combined_df['Model'].unique()
|
182 |
)
|
183 |
|
|
|
|
|
|
|
|
|
184 |
class_data = st.session_state.combined_df[
|
185 |
(st.session_state.combined_df['Category'] == selected_category) &
|
186 |
(~st.session_state.combined_df['Class'].str.contains('Overall')) &
|
187 |
(st.session_state.combined_df['Model'].isin(selected_models))
|
188 |
]
|
189 |
|
190 |
-
# Bar chart
|
191 |
fig = px.bar(
|
192 |
class_data,
|
193 |
x='Class',
|
194 |
y=selected_metric,
|
195 |
color='Model',
|
196 |
barmode='group',
|
197 |
-
title=f'{selected_metric} by Class for {selected_category}'
|
|
|
198 |
)
|
199 |
st.plotly_chart(fig, use_container_width=True)
|
200 |
|
201 |
-
# Create a shared legend container
|
202 |
-
legend_data = []
|
203 |
-
for i, model in enumerate(selected_models):
|
204 |
-
legend_data.append({
|
205 |
-
'Model': model,
|
206 |
-
'Visible': True,
|
207 |
-
'Index': i
|
208 |
-
})
|
209 |
-
legend_df = pd.DataFrame(legend_data)
|
210 |
-
|
211 |
-
# Create toggles for models using st.columns
|
212 |
-
st.markdown("### Select Models to Display:")
|
213 |
-
|
214 |
# Calculate how many columns we need (aim for about 4-5 models per row)
|
215 |
models_per_row = 4
|
216 |
num_rows = (len(selected_models) + models_per_row - 1) // models_per_row
|
217 |
|
|
|
|
|
|
|
218 |
for row in range(num_rows):
|
219 |
cols = st.columns(models_per_row)
|
220 |
for col_idx in range(models_per_row):
|
@@ -223,9 +218,8 @@ with tab2:
|
|
223 |
model = selected_models[model_idx]
|
224 |
container = cols[col_idx].container()
|
225 |
|
226 |
-
# Get
|
227 |
-
|
228 |
-
color = plotly_colors[model_idx % len(plotly_colors)]
|
229 |
|
230 |
# Store toggle state in session state with unique key
|
231 |
toggle_key = f"toggle_{model}"
|
@@ -234,12 +228,12 @@ with tab2:
|
|
234 |
|
235 |
# Create the checkbox with colored text
|
236 |
st.session_state[toggle_key] = container.checkbox(
|
237 |
-
f"⬤ {model}",
|
238 |
value=st.session_state[toggle_key],
|
239 |
key=f"model_toggle_{model}"
|
240 |
)
|
241 |
|
242 |
-
# Add colored style to the
|
243 |
container.markdown(
|
244 |
f"""
|
245 |
<style>
|
@@ -282,7 +276,8 @@ with tab2:
|
|
282 |
y='Recall',
|
283 |
color='Model',
|
284 |
title=f'Precision vs Recall: {current_class}',
|
285 |
-
height=300
|
|
|
286 |
)
|
287 |
|
288 |
# Update layout for better visibility
|
|
|
181 |
default=st.session_state.combined_df['Model'].unique()
|
182 |
)
|
183 |
|
184 |
+
# Create a consistent color mapping for all models
|
185 |
+
plotly_colors = ['#636EFA', '#EF553B', '#00CC96', '#AB63FA', '#FFA15A', '#19D3F3', '#FF6692', '#B6E880', '#FF97FF', '#FECB52']
|
186 |
+
model_colors = {model: plotly_colors[i % len(plotly_colors)] for i, model in enumerate(sorted(st.session_state.combined_df['Model'].unique()))}
|
187 |
+
|
188 |
class_data = st.session_state.combined_df[
|
189 |
(st.session_state.combined_df['Category'] == selected_category) &
|
190 |
(~st.session_state.combined_df['Class'].str.contains('Overall')) &
|
191 |
(st.session_state.combined_df['Model'].isin(selected_models))
|
192 |
]
|
193 |
|
194 |
+
# Bar chart with consistent colors
|
195 |
fig = px.bar(
|
196 |
class_data,
|
197 |
x='Class',
|
198 |
y=selected_metric,
|
199 |
color='Model',
|
200 |
barmode='group',
|
201 |
+
title=f'{selected_metric} by Class for {selected_category}',
|
202 |
+
color_discrete_map=model_colors
|
203 |
)
|
204 |
st.plotly_chart(fig, use_container_width=True)
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
# Calculate how many columns we need (aim for about 4-5 models per row)
|
207 |
models_per_row = 4
|
208 |
num_rows = (len(selected_models) + models_per_row - 1) // models_per_row
|
209 |
|
210 |
+
st.markdown("### Select Models to Display:")
|
211 |
+
|
212 |
+
# Create toggles for models using st.columns
|
213 |
for row in range(num_rows):
|
214 |
cols = st.columns(models_per_row)
|
215 |
for col_idx in range(models_per_row):
|
|
|
218 |
model = selected_models[model_idx]
|
219 |
container = cols[col_idx].container()
|
220 |
|
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}"
|
|
|
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>
|
|
|
276 |
y='Recall',
|
277 |
color='Model',
|
278 |
title=f'Precision vs Recall: {current_class}',
|
279 |
+
height=300,
|
280 |
+
color_discrete_map=model_colors # Use consistent colors
|
281 |
)
|
282 |
|
283 |
# Update layout for better visibility
|