Mollel commited on
Commit
0f060f8
1 Parent(s): 5a4b675

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -65
app.py CHANGED
@@ -55,29 +55,8 @@ def setup_page():
55
  st.title("⚡ Swahili Text Embeddings Leaderboard (STEL)")
56
  st.image("https://raw.githubusercontent.com/username/repo/main/files/STEL.jpg", width=300)
57
 
58
- # def display_leaderboard(df):
59
- # """Display the leaderboard."""
60
- # st.header("📊 Leaderboard")
61
-
62
- # # Determine which non-benchmark columns are present
63
- # present_non_benchmark_cols = [col for col in POSSIBLE_NON_BENCHMARK_COLS if col in df.columns]
64
-
65
- # # Add filters
66
- # columns_to_filter = [col for col in df.columns if col not in present_non_benchmark_cols]
67
- # selected_columns = st.multiselect("Select benchmarks to display:", columns_to_filter, default=columns_to_filter)
68
-
69
- # # Filter dataframe
70
- # df_display = df[present_non_benchmark_cols + selected_columns]
71
-
72
- # # Display dataframe
73
- # st.dataframe(df_display.style.format("{:.4f}", subset=[col for col in df_display.columns if df_display[col].dtype == 'float64']))
74
-
75
- # # Download buttons
76
- # csv = df_display.to_csv(index=False)
77
- # st.download_button(label="Download as CSV", data=csv, file_name="leaderboard.csv", mime="text/csv")
78
-
79
  def display_leaderboard(df):
80
- """Display the leaderboard with compact columns."""
81
  st.header("📊 Leaderboard")
82
 
83
  # Determine which non-benchmark columns are present
@@ -90,54 +69,75 @@ def display_leaderboard(df):
90
  # Filter dataframe
91
  df_display = df[present_non_benchmark_cols + selected_columns]
92
 
93
- # Define column widths
94
- col_widths = {
95
- "Model Name": 200,
96
- "Publisher": 100,
97
- "Open?": 60,
98
- "Basemodel": 150,
99
- "Matryoshka": 80,
100
- "Dimension": 80,
101
- "Average": 80
102
- }
103
-
104
- # Set default width for benchmark columns
105
- default_width = 80
106
-
107
- # Custom CSS to make the table more compact
108
- st.markdown("""
109
- <style>
110
- .streamlit-expanderHeader {
111
- font-size: 1em;
112
- }
113
- .stDataFrame {
114
- font-size: 0.8em;
115
- }
116
- .stDataFrame td, .stDataFrame th {
117
- white-space: nowrap;
118
- overflow: hidden;
119
- text-overflow: ellipsis;
120
- max-width: 200px;
121
- }
122
- </style>
123
- """, unsafe_allow_html=True)
124
-
125
- # Format the dataframe
126
- df_styled = df_display.style.format({col: "{:.2f}" for col in df_display.columns if df_display[col].dtype in ['float64', 'int64']})
127
-
128
- # Set column widths
129
- df_styled.set_properties(**{
130
- 'width': lambda x: f"{col_widths.get(x.name, default_width)}px",
131
- 'max-width': lambda x: f"{col_widths.get(x.name, default_width)}px",
132
- })
133
-
134
- # Display the dataframe
135
- st.dataframe(df_styled, height=400)
136
 
137
  # Download buttons
138
  csv = df_display.to_csv(index=False)
139
  st.download_button(label="Download as CSV", data=csv, file_name="leaderboard.csv", mime="text/csv")
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
 
143
  def display_evaluation():
 
55
  st.title("⚡ Swahili Text Embeddings Leaderboard (STEL)")
56
  st.image("https://raw.githubusercontent.com/username/repo/main/files/STEL.jpg", width=300)
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  def display_leaderboard(df):
59
+ """Display the leaderboard."""
60
  st.header("📊 Leaderboard")
61
 
62
  # Determine which non-benchmark columns are present
 
69
  # Filter dataframe
70
  df_display = df[present_non_benchmark_cols + selected_columns]
71
 
72
+ # Display dataframe
73
+ st.dataframe(df_display.style.format("{:.4f}", subset=[col for col in df_display.columns if df_display[col].dtype == 'float64']))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  # Download buttons
76
  csv = df_display.to_csv(index=False)
77
  st.download_button(label="Download as CSV", data=csv, file_name="leaderboard.csv", mime="text/csv")
78
 
79
+ # def display_leaderboard(df):
80
+ # """Display the leaderboard with compact columns."""
81
+ # st.header("📊 Leaderboard")
82
+
83
+ # # Determine which non-benchmark columns are present
84
+ # present_non_benchmark_cols = [col for col in POSSIBLE_NON_BENCHMARK_COLS if col in df.columns]
85
+
86
+ # # Add filters
87
+ # columns_to_filter = [col for col in df.columns if col not in present_non_benchmark_cols]
88
+ # selected_columns = st.multiselect("Select benchmarks to display:", columns_to_filter, default=columns_to_filter)
89
+
90
+ # # Filter dataframe
91
+ # df_display = df[present_non_benchmark_cols + selected_columns]
92
+
93
+ # # Define column widths
94
+ # col_widths = {
95
+ # "Model Name": 200,
96
+ # "Publisher": 100,
97
+ # "Open?": 60,
98
+ # "Basemodel": 150,
99
+ # "Matryoshka": 80,
100
+ # "Dimension": 80,
101
+ # "Average": 80
102
+ # }
103
+
104
+ # # Set default width for benchmark columns
105
+ # default_width = 80
106
+
107
+ # # Custom CSS to make the table more compact
108
+ # st.markdown("""
109
+ # <style>
110
+ # .streamlit-expanderHeader {
111
+ # font-size: 1em;
112
+ # }
113
+ # .stDataFrame {
114
+ # font-size: 0.8em;
115
+ # }
116
+ # .stDataFrame td, .stDataFrame th {
117
+ # white-space: nowrap;
118
+ # overflow: hidden;
119
+ # text-overflow: ellipsis;
120
+ # max-width: 200px;
121
+ # }
122
+ # </style>
123
+ # """, unsafe_allow_html=True)
124
+
125
+ # # Format the dataframe
126
+ # df_styled = df_display.style.format({col: "{:.2f}" for col in df_display.columns if df_display[col].dtype in ['float64', 'int64']})
127
+
128
+ # # Set column widths
129
+ # df_styled.set_properties(**{
130
+ # 'width': lambda x: f"{col_widths.get(x.name, default_width)}px",
131
+ # 'max-width': lambda x: f"{col_widths.get(x.name, default_width)}px",
132
+ # })
133
+
134
+ # # Display the dataframe
135
+ # st.dataframe(df_styled, height=400)
136
+
137
+ # # Download buttons
138
+ # csv = df_display.to_csv(index=False)
139
+ # st.download_button(label="Download as CSV", data=csv, file_name="leaderboard.csv", mime="text/csv")
140
+
141
 
142
 
143
  def display_evaluation():