dimbyTa commited on
Commit
eeeb78f
1 Parent(s): 9533412

fixing checkboxes

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -1
  2. src/display.py +8 -5
requirements.txt CHANGED
@@ -4,4 +4,4 @@ matplotlib
4
  plotly
5
  streamlit-nightly
6
  streamlit-aggrid
7
- streamlit-searchbox
 
4
  plotly
5
  streamlit-nightly
6
  streamlit-aggrid
7
+ streamlit-searchbox==0.1.8
src/display.py CHANGED
@@ -41,11 +41,11 @@ def display_app():
41
  # Dynamic search boxes
42
  def search_model(model_name: str):
43
  model_list = None
44
- if model_name is not None:
45
  models = dataframe["model_name"].str.contains(model_name)
46
  model_list = dataframe["model_name"][models]
47
  else:
48
- model_list = []
49
  return model_list
50
 
51
  model_list = []
@@ -114,7 +114,6 @@ def display_app():
114
  row = dataframe[dataframe["model_name"] == model_three]
115
  row[categories_display] = row[categories_display]*100
116
  model_list.append(row.to_dict("records")[0])
117
-
118
  subdata = dataframe.head(1)
119
  if len(subdata) > 0:
120
  model_name = subdata["model_name"].values[0]
@@ -124,7 +123,9 @@ def display_app():
124
  with column2:
125
  if grid_response['selected_rows'] is not None and len(grid_response['selected_rows']) > 0:
126
  figure = None
127
- model_list += grid_response['selected_rows']
 
 
128
  model_list = model_list[:3]
129
  model_list = sorted(model_list, key = lambda x: x["Average"], reverse = True)
130
 
@@ -201,4 +202,6 @@ def display_app():
201
  st.markdown("For more details, hover over the radar chart.")
202
  else:
203
  st.markdown("**Model name:** %s" % model_name)
204
- st.markdown("For more details, select the first model in the list/leaderboard.")
 
 
 
41
  # Dynamic search boxes
42
  def search_model(model_name: str):
43
  model_list = None
44
+ if model_name is not None or model_name != "":
45
  models = dataframe["model_name"].str.contains(model_name)
46
  model_list = dataframe["model_name"][models]
47
  else:
48
+ model_list = dataframe["model_name"]
49
  return model_list
50
 
51
  model_list = []
 
114
  row = dataframe[dataframe["model_name"] == model_three]
115
  row[categories_display] = row[categories_display]*100
116
  model_list.append(row.to_dict("records")[0])
 
117
  subdata = dataframe.head(1)
118
  if len(subdata) > 0:
119
  model_name = subdata["model_name"].values[0]
 
123
  with column2:
124
  if grid_response['selected_rows'] is not None and len(grid_response['selected_rows']) > 0:
125
  figure = None
126
+ #grid_response is now a Pandas dataframe, we need to
127
+ # convert to dict in order to merge with the searchboxes' results
128
+ model_list += grid_response['selected_rows'].to_dict("records")
129
  model_list = model_list[:3]
130
  model_list = sorted(model_list, key = lambda x: x["Average"], reverse = True)
131
 
 
202
  st.markdown("For more details, hover over the radar chart.")
203
  else:
204
  st.markdown("**Model name:** %s" % model_name)
205
+ st.markdown("For more details, select the first model in the list/leaderboard.")
206
+
207
+