gilalnauman commited on
Commit
0c2f7df
·
verified ·
1 Parent(s): b3845f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +119 -119
app.py CHANGED
@@ -157,116 +157,16 @@
157
 
158
 
159
 
160
- # import streamlit as st
161
- # import pandas as pd
162
- # import altair as alt
163
-
164
- # # Load the leaderboard data
165
- # df = pd.read_csv("leaderboard.csv")
166
-
167
- # # Add title and description
168
- # st.title("PathVLMs Leaderboard")
169
- # st.write("Interactive leaderboard for Pathology Language Model-based Methods (LMMs).")
170
-
171
- # # Sidebar Filters
172
- # with st.sidebar:
173
- # st.subheader("Filters")
174
- # # Search by model name (fuzzy search)
175
- # search_query = st.text_input("Search for Model Name", value="", placeholder="e.g., llava")
176
-
177
- # # Filter by model size
178
- # model_sizes = df['Params (B)'].unique()
179
- # selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
180
-
181
- # # Filter by model type (if available)
182
- # if 'Language Model' in df.columns:
183
- # model_types = df['Language Model'].unique()
184
- # selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
185
- # else:
186
- # selected_types = []
187
-
188
- # # Apply Filters
189
- # filtered_df = df[
190
- # (df['Params (B)'].isin(selected_sizes)) &
191
- # (df['Language Model'].isin(selected_types) if selected_types else True) &
192
- # (df['Method'].str.contains(search_query, case=False, na=False))
193
- # ]
194
-
195
- # # Warning if no results
196
- # if filtered_df.empty:
197
- # st.warning("No results found. Try adjusting the filters.")
198
- # else:
199
- # # Leaderboard Table
200
- # st.subheader("Filtered Leaderboard Table")
201
- # st.dataframe(filtered_df)
202
-
203
- # # Select Metric to Visualize
204
- # st.subheader("Visualization")
205
- # metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
206
-
207
- # # Visualization
208
- # chart = alt.Chart(filtered_df).mark_bar().encode(
209
- # x=alt.X('Method', sort='-y', title="Model"),
210
- # y=alt.Y(metric, title=metric),
211
- # color='Method',
212
- # tooltip=['Method', metric]
213
- # ).properties(
214
- # width=800,
215
- # height=400
216
- # )
217
- # st.altair_chart(chart, use_container_width=True)
218
-
219
- # # Highlight Top N Models
220
- # st.subheader("Highlight Top N Models")
221
- # top_n = st.slider("Number of Top Models", min_value=1, max_value=len(filtered_df), value=5)
222
- # top_models_df = filtered_df.nlargest(top_n, metric)
223
-
224
- # top_chart = alt.Chart(top_models_df).mark_bar().encode(
225
- # x=alt.X('Method', title="Model"),
226
- # y=alt.Y(metric, title=metric),
227
- # color='Method',
228
- # tooltip=['Method', metric]
229
- # ).properties(
230
- # width=800,
231
- # height=400
232
- # )
233
- # st.altair_chart(top_chart, use_container_width=True)
234
-
235
- # # Download Button
236
- # @st.cache
237
- # def convert_df_to_csv(dataframe):
238
- # return dataframe.to_csv(index=False).encode('utf-8')
239
-
240
- # csv_data = convert_df_to_csv(filtered_df)
241
- # st.download_button(
242
- # label="Download Filtered Results",
243
- # data=csv_data,
244
- # file_name="filtered_leaderboard.csv",
245
- # mime="text/csv"
246
- # )
247
-
248
-
249
-
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(
256
- page_title="PathVLMs Leaderboard",
257
- page_icon="🏆",
258
- layout="wide"
259
- )
260
-
261
  # Load the leaderboard data
262
  df = pd.read_csv("leaderboard.csv")
263
 
264
  # Add title and description
265
- st.title("PathVLMs Leaderboard 🏆")
266
- st.markdown("""
267
- Welcome to the **PathVLMs Leaderboard**! This leaderboard displays evaluation results for various models in Pathology Language-Model-based Methods (LMMs).
268
- You can search, filter, and visualize metrics for better insights.
269
- """)
270
 
271
  # Sidebar Filters
272
  with st.sidebar:
@@ -278,7 +178,7 @@ with st.sidebar:
278
  model_sizes = df['Params (B)'].unique()
279
  selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
280
 
281
- # Filter by model type
282
  if 'Language Model' in df.columns:
283
  model_types = df['Language Model'].unique()
284
  selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
@@ -292,31 +192,27 @@ filtered_df = df[
292
  (df['Method'].str.contains(search_query, case=False, na=False))
293
  ]
294
 
295
- # Main Leaderboard Section
296
- st.subheader("Leaderboard Table")
297
  if filtered_df.empty:
298
  st.warning("No results found. Try adjusting the filters.")
299
  else:
300
- # Display table in wide layout
301
- st.dataframe(
302
- filtered_df,
303
- height=600, # Adjust table height
304
- width=1600 # Adjust table width
305
- )
306
 
307
- # Visualization of selected metric
308
- st.subheader("Performance Metrics Visualization")
309
  metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
310
 
311
- # Visualization Chart
312
  chart = alt.Chart(filtered_df).mark_bar().encode(
313
- x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
314
  y=alt.Y(metric, title=metric),
315
  color='Method',
316
  tooltip=['Method', metric]
317
  ).properties(
318
- width=1400, # Full width
319
- height=600 # Increased height
320
  )
321
  st.altair_chart(chart, use_container_width=True)
322
 
@@ -331,8 +227,8 @@ else:
331
  color='Method',
332
  tooltip=['Method', metric]
333
  ).properties(
334
- width=1400, # Full width
335
- height=400 # Adjusted height for smaller chart
336
  )
337
  st.altair_chart(top_chart, use_container_width=True)
338
 
@@ -351,6 +247,110 @@ else:
351
 
352
 
353
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  # import streamlit as st
355
  # import pandas as pd
356
  # import altair as alt
 
157
 
158
 
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  import streamlit as st
161
  import pandas as pd
162
  import altair as alt
163
 
 
 
 
 
 
 
 
164
  # Load the leaderboard data
165
  df = pd.read_csv("leaderboard.csv")
166
 
167
  # Add title and description
168
+ st.title("PathVLMs Leaderboard")
169
+ st.write("Interactive leaderboard for Pathology Language Model-based Methods (LMMs).")
 
 
 
170
 
171
  # Sidebar Filters
172
  with st.sidebar:
 
178
  model_sizes = df['Params (B)'].unique()
179
  selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
180
 
181
+ # Filter by model type (if available)
182
  if 'Language Model' in df.columns:
183
  model_types = df['Language Model'].unique()
184
  selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
 
192
  (df['Method'].str.contains(search_query, case=False, na=False))
193
  ]
194
 
195
+ # Warning if no results
 
196
  if filtered_df.empty:
197
  st.warning("No results found. Try adjusting the filters.")
198
  else:
199
+ # Leaderboard Table
200
+ st.subheader("Filtered Leaderboard Table")
201
+ st.dataframe(filtered_df)
 
 
 
202
 
203
+ # Select Metric to Visualize
204
+ st.subheader("Visualization")
205
  metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
206
 
207
+ # Visualization
208
  chart = alt.Chart(filtered_df).mark_bar().encode(
209
+ x=alt.X('Method', sort='-y', title="Model"),
210
  y=alt.Y(metric, title=metric),
211
  color='Method',
212
  tooltip=['Method', metric]
213
  ).properties(
214
+ width=800,
215
+ height=400
216
  )
217
  st.altair_chart(chart, use_container_width=True)
218
 
 
227
  color='Method',
228
  tooltip=['Method', metric]
229
  ).properties(
230
+ width=800,
231
+ height=400
232
  )
233
  st.altair_chart(top_chart, use_container_width=True)
234
 
 
247
 
248
 
249
 
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(
256
+ # page_title="PathVLMs Leaderboard",
257
+ # page_icon="🏆",
258
+ # layout="wide"
259
+ # )
260
+
261
+ # # Load the leaderboard data
262
+ # df = pd.read_csv("leaderboard.csv")
263
+
264
+ # # Add title and description
265
+ # st.title("PathVLMs Leaderboard 🏆")
266
+ # st.markdown("""
267
+ # Welcome to the **PathVLMs Leaderboard**! This leaderboard displays evaluation results for various models in Pathology Language-Model-based Methods (LMMs).
268
+ # You can search, filter, and visualize metrics for better insights.
269
+ # """)
270
+
271
+ # # Sidebar Filters
272
+ # with st.sidebar:
273
+ # st.subheader("Filters")
274
+ # # Search by model name (fuzzy search)
275
+ # search_query = st.text_input("Search for Model Name", value="", placeholder="e.g., llava")
276
+
277
+ # # Filter by model size
278
+ # model_sizes = df['Params (B)'].unique()
279
+ # selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
280
+
281
+ # # Filter by model type
282
+ # if 'Language Model' in df.columns:
283
+ # model_types = df['Language Model'].unique()
284
+ # selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
285
+ # else:
286
+ # selected_types = []
287
+
288
+ # # Apply Filters
289
+ # filtered_df = df[
290
+ # (df['Params (B)'].isin(selected_sizes)) &
291
+ # (df['Language Model'].isin(selected_types) if selected_types else True) &
292
+ # (df['Method'].str.contains(search_query, case=False, na=False))
293
+ # ]
294
+
295
+ # # Main Leaderboard Section
296
+ # st.subheader("Leaderboard Table")
297
+ # if filtered_df.empty:
298
+ # st.warning("No results found. Try adjusting the filters.")
299
+ # else:
300
+ # # Display table in wide layout
301
+ # st.dataframe(
302
+ # filtered_df,
303
+ # height=600, # Adjust table height
304
+ # width=1600 # Adjust table width
305
+ # )
306
+
307
+ # # Visualization of selected metric
308
+ # st.subheader("Performance Metrics Visualization")
309
+ # metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
310
+
311
+ # # Visualization Chart
312
+ # chart = alt.Chart(filtered_df).mark_bar().encode(
313
+ # x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
314
+ # y=alt.Y(metric, title=metric),
315
+ # color='Method',
316
+ # tooltip=['Method', metric]
317
+ # ).properties(
318
+ # width=1400, # Full width
319
+ # height=600 # Increased height
320
+ # )
321
+ # st.altair_chart(chart, use_container_width=True)
322
+
323
+ # # Highlight Top N Models
324
+ # st.subheader("Highlight Top N Models")
325
+ # top_n = st.slider("Number of Top Models", min_value=1, max_value=len(filtered_df), value=5)
326
+ # top_models_df = filtered_df.nlargest(top_n, metric)
327
+
328
+ # top_chart = alt.Chart(top_models_df).mark_bar().encode(
329
+ # x=alt.X('Method', title="Model"),
330
+ # y=alt.Y(metric, title=metric),
331
+ # color='Method',
332
+ # tooltip=['Method', metric]
333
+ # ).properties(
334
+ # width=1400, # Full width
335
+ # height=400 # Adjusted height for smaller chart
336
+ # )
337
+ # st.altair_chart(top_chart, use_container_width=True)
338
+
339
+ # # Download Button
340
+ # @st.cache
341
+ # def convert_df_to_csv(dataframe):
342
+ # return dataframe.to_csv(index=False).encode('utf-8')
343
+
344
+ # csv_data = convert_df_to_csv(filtered_df)
345
+ # st.download_button(
346
+ # label="Download Filtered Results",
347
+ # data=csv_data,
348
+ # file_name="filtered_leaderboard.csv",
349
+ # mime="text/csv"
350
+ # )
351
+
352
+
353
+
354
  # import streamlit as st
355
  # import pandas as pd
356
  # import altair as alt