Anas Awadalla commited on
Commit
98d976c
·
1 Parent(s): 305d1af

multi select models

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +38 -5
src/streamlit_app.py CHANGED
@@ -414,16 +414,49 @@ def main():
414
  # Filter data
415
  filtered_df = df[df['dataset'] == selected_dataset]
416
 
417
- # Model filter (optional)
418
- models = ['All'] + sorted(filtered_df['model'].unique())
419
- selected_model = st.sidebar.selectbox("Select Model", models)
420
 
421
- if selected_model != 'All':
422
- filtered_df = filtered_df[filtered_df['model'] == selected_model]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
 
424
  # Main content
425
  st.header(f"Results for {selected_dataset}")
426
 
 
 
 
 
 
427
  # Overall metrics
428
  col1, col2, col3 = st.columns(3)
429
  with col1:
 
414
  # Filter data
415
  filtered_df = df[df['dataset'] == selected_dataset]
416
 
417
+ # Model filter - changed to multiselect for selective visualization
418
+ st.sidebar.subheader("Select Models to Display")
419
+ all_models = sorted(filtered_df['model'].unique())
420
 
421
+ # Add "Select All" / "Deselect All" buttons
422
+ col1, col2 = st.sidebar.columns(2)
423
+ with col1:
424
+ if st.button("Select All", key="select_all"):
425
+ st.session_state['selected_models'] = all_models
426
+ with col2:
427
+ if st.button("Deselect All", key="deselect_all"):
428
+ st.session_state['selected_models'] = []
429
+
430
+ # Initialize selected models if not in session state
431
+ if 'selected_models' not in st.session_state:
432
+ st.session_state['selected_models'] = all_models
433
+
434
+ # Multi-select widget for models
435
+ selected_models = st.sidebar.multiselect(
436
+ "Models to visualize:",
437
+ options=all_models,
438
+ default=st.session_state.get('selected_models', all_models),
439
+ key='model_multiselect'
440
+ )
441
+
442
+ # Update session state
443
+ st.session_state['selected_models'] = selected_models
444
+
445
+ # Filter dataframe based on selected models
446
+ if selected_models:
447
+ filtered_df = filtered_df[filtered_df['model'].isin(selected_models)]
448
+ else:
449
+ # If no models selected, show empty dataframe
450
+ filtered_df = pd.DataFrame()
451
 
452
  # Main content
453
  st.header(f"Results for {selected_dataset}")
454
 
455
+ # Check if any models are selected
456
+ if filtered_df.empty:
457
+ st.warning("No models selected. Please select at least one model from the sidebar to visualize results.")
458
+ return
459
+
460
  # Overall metrics
461
  col1, col2, col3 = st.columns(3)
462
  with col1: