gilalnauman commited on
Commit
84cfd97
·
verified ·
1 Parent(s): 987bb46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -18
app.py CHANGED
@@ -250,7 +250,6 @@
250
  import streamlit as st
251
  import pandas as pd
252
  import altair as alt
253
- from st_aggrid import AgGrid, GridOptionsBuilder
254
 
255
  # Set page layout to wide mode
256
  st.set_page_config(
@@ -293,27 +292,25 @@ filtered_df = df[
293
  (df['Method'].str.contains(search_query, case=False, na=False))
294
  ]
295
 
296
- # Main Leaderboard Section
297
  st.subheader("Leaderboard Table")
298
  if filtered_df.empty:
299
  st.warning("No results found. Try adjusting the filters.")
300
  else:
301
- # Interactive table with AgGrid
302
- records_per_page = st.selectbox("Records per Page", [10, 20, 50, 100], index=0)
303
- gb = GridOptionsBuilder.from_dataframe(filtered_df)
304
- gb.configure_pagination(paginationAutoPageSize=False, paginationPageSize=records_per_page)
305
- gb.configure_default_column(editable=False, groupable=True)
306
- grid_options = gb.build()
307
-
308
- st.markdown("### Interactive Table")
309
- AgGrid(
310
- filtered_df,
311
- gridOptions=grid_options,
312
- enable_enterprise_modules=False,
313
- theme='streamlit',
314
- height=400, # Adjust as needed
315
- fit_columns_on_grid_load=True
316
  )
 
 
 
 
 
317
 
318
  # Visualization of selected metric
319
  st.subheader("Performance Metrics Visualization")
@@ -331,7 +328,7 @@ else:
331
  )
332
  st.altair_chart(chart, use_container_width=True)
333
 
334
- # Interactive Bubble Plot: Metric vs. Model Size
335
  st.subheader("Interactive Bubble Plot: Metric vs. Model Size")
336
  bubble_metric = st.selectbox("Select Metric for Bubble Plot", options=filtered_df.columns[5:], index=0)
337
 
 
250
  import streamlit as st
251
  import pandas as pd
252
  import altair as alt
 
253
 
254
  # Set page layout to wide mode
255
  st.set_page_config(
 
292
  (df['Method'].str.contains(search_query, case=False, na=False))
293
  ]
294
 
295
+ # Manual Pagination Section
296
  st.subheader("Leaderboard Table")
297
  if filtered_df.empty:
298
  st.warning("No results found. Try adjusting the filters.")
299
  else:
300
+ # Pagination controls
301
+ page_size = st.sidebar.selectbox("Rows per page", [10, 20, 50], index=0)
302
+ page_number = st.sidebar.number_input(
303
+ "Page number",
304
+ min_value=1,
305
+ max_value=(len(filtered_df) // page_size) + 1,
306
+ step=1,
307
+ value=1
 
 
 
 
 
 
 
308
  )
309
+ start_index = (page_number - 1) * page_size
310
+ end_index = start_index + page_size
311
+
312
+ # Paginated table
313
+ st.dataframe(filtered_df.iloc[start_index:end_index], use_container_width=True)
314
 
315
  # Visualization of selected metric
316
  st.subheader("Performance Metrics Visualization")
 
328
  )
329
  st.altair_chart(chart, use_container_width=True)
330
 
331
+ # Bubble Plot: Metric vs. Model Size
332
  st.subheader("Interactive Bubble Plot: Metric vs. Model Size")
333
  bubble_metric = st.selectbox("Select Metric for Bubble Plot", options=filtered_df.columns[5:], index=0)
334