Corey Morris commited on
Commit
43b4e29
1 Parent(s): e3642ff

WIP commit. Troubleshoot chart display. Add behavior of filter

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py CHANGED
@@ -48,6 +48,14 @@ class MultiURLData:
48
 
49
  data_provider = MultiURLData()
50
 
 
 
 
 
 
 
 
 
51
  # Create checkboxes for each column
52
  selected_columns = st.multiselect(
53
  'Select Columns',
@@ -65,3 +73,30 @@ selected_models = st.multiselect(
65
  # Get the filtered data and display it in a table
66
  filtered_data = data_provider.get_data(selected_models)
67
  st.dataframe(filtered_data)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  data_provider = MultiURLData()
50
 
51
+ st.title('Leaderboard')
52
+
53
+ # TODO actually use these checkboxes as filters
54
+ ## Desired behavior
55
+ ## model and column selection is hidden by default
56
+ ## when the user clicks the checkbox, the model and column selection appears
57
+ filters = st.checkbox('Add filters')
58
+
59
  # Create checkboxes for each column
60
  selected_columns = st.multiselect(
61
  'Select Columns',
 
73
  # Get the filtered data and display it in a table
74
  filtered_data = data_provider.get_data(selected_models)
75
  st.dataframe(filtered_data)
76
+
77
+
78
+
79
+ #TODO fix this plot. currently has an error
80
+ # Create a plot with new data
81
+ df = pd.DataFrame({
82
+ 'Model': list(filtered_data['Model Name']),
83
+ 'harness|arc:challenge|25_rank': list(filtered_data['harness|arc:challenge|25_rank']),
84
+ 'harness|moral_scenarios|5_rank': list(filtered_data['harness|moral_scenarios|5_rank']),
85
+ })
86
+
87
+ # Calculate color column
88
+ df['color'] = 'purple'
89
+ df.loc[df['harness|moral_scenarios|5_rank'] < df['harness|arc:challenge|25_rank'], 'color'] = 'red'
90
+ df.loc[df['harness|moral_scenarios|5_rank'] > df['harness|arc:challenge|25_rank'], 'color'] = 'blue'
91
+
92
+ # Create the scatter plot
93
+ fig = px.scatter(df, x='harness|arc:challenge|25_rank', y='harness|moral_scenarios|5_rank', color='color', hover_data=['Model'])
94
+ fig.update_layout(showlegend=False, # hide legend
95
+ xaxis = dict(autorange="reversed"), # reverse X-axis
96
+ yaxis = dict(autorange="reversed")) # reverse Y-axis
97
+
98
+ # Show the plot in Streamlit
99
+ st.plotly_chart(fig)
100
+
101
+
102
+