gilalnauman commited on
Commit
b3845f0
·
verified ·
1 Parent(s): 6f737a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +220 -220
app.py CHANGED
@@ -247,107 +247,107 @@
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
 
@@ -473,143 +473,143 @@
473
 
474
 
475
 
476
- import streamlit as st
477
- import pandas as pd
478
- import altair as alt
479
 
480
- # Set page layout to wide mode
481
- st.set_page_config(
482
- page_title="PathVLMs Leaderboard",
483
- page_icon="🏆",
484
- layout="wide"
485
- )
486
 
487
- # Load the leaderboard data
488
- df = pd.read_csv("leaderboard.csv")
489
 
490
- # Add custom CSS for alignment
491
- st.markdown(
492
- """
493
- <style>
494
- .centered {
495
- display: flex;
496
- justify-content: center;
497
- align-items: center;
498
- flex-direction: column;
499
- }
500
- .search-bar {
501
- width: 60%;
502
- margin-bottom: 20px;
503
- }
504
- </style>
505
- """,
506
- unsafe_allow_html=True
507
- )
508
 
509
- # Add title and description
510
- st.title("PathVLMs Leaderboard 🏆")
511
- st.markdown("""
512
- Welcome to the **PathVLMs Leaderboard**! This leaderboard displays evaluation results for various models in Pathology Language-Model-based Methods (LMMs).
513
- You can search, filter, and visualize metrics for better insights.
514
- """)
515
 
516
- # Create a layout with two columns: main content (left) and filters (right)
517
- col1, col2 = st.columns([4, 1]) # Adjust column ratio
518
 
519
- # Filters on the right
520
- with col2:
521
- st.subheader("Filters")
522
 
523
- # Search by model name
524
- search_query = st.text_input(
525
- "Search for Model Name",
526
- value="",
527
- placeholder="e.g., llava",
528
- key="search_bar",
529
- help="Enter part of a model name to filter the leaderboard.",
530
- )
531
 
532
- # Filter by model size
533
- model_sizes = df['Params (B)'].unique()
534
- selected_sizes = st.multiselect(
535
- "Select Model Sizes",
536
- options=model_sizes,
537
- default=model_sizes
538
- )
539
 
540
- # Filter by model type (if applicable)
541
- if 'Language Model' in df.columns:
542
- model_types = df['Language Model'].unique()
543
- selected_types = st.multiselect(
544
- "Select Model Types",
545
- options=model_types,
546
- default=model_types
547
- )
548
- else:
549
- selected_types = []
550
 
551
- # Main content on the left
552
- with col1:
553
- # Apply filters to the DataFrame
554
- filtered_df = df[
555
- (df['Params (B)'].isin(selected_sizes)) &
556
- (df['Language Model'].isin(selected_types) if selected_types else True) &
557
- (df['Method'].str.contains(search_query, case=False, na=False))
558
- ]
559
-
560
- # Warning if no results
561
- if filtered_df.empty:
562
- st.warning("No results found. Try adjusting the filters.")
563
- else:
564
- # Display the filtered leaderboard table
565
- st.markdown('<div class="centered">', unsafe_allow_html=True)
566
- st.subheader("Leaderboard Table")
567
- st.dataframe(filtered_df, height=600, width=1400) # Adjust table size
568
- st.markdown('</div>', unsafe_allow_html=True)
569
-
570
- # Visualization Section
571
- st.subheader("Performance Metrics Visualization")
572
- metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
573
-
574
- chart = alt.Chart(filtered_df).mark_bar().encode(
575
- x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
576
- y=alt.Y(metric, title=metric),
577
- color='Method',
578
- tooltip=['Method', metric]
579
- ).properties(
580
- width=1000, # Adjust chart width
581
- height=500 # Adjust chart height
582
- )
583
- st.altair_chart(chart, use_container_width=True)
584
-
585
- # Highlight Top N Models
586
- st.subheader("Highlight Top N Models")
587
- top_n = st.slider("Number of Top Models", min_value=1, max_value=len(filtered_df), value=5)
588
- top_models_df = filtered_df.nlargest(top_n, metric)
589
-
590
- top_chart = alt.Chart(top_models_df).mark_bar().encode(
591
- x=alt.X('Method', title="Model"),
592
- y=alt.Y(metric, title=metric),
593
- color='Method',
594
- tooltip=['Method', metric]
595
- ).properties(
596
- width=1000,
597
- height=400
598
- )
599
- st.altair_chart(top_chart, use_container_width=True)
600
-
601
- # Download Button
602
- @st.cache
603
- def convert_df_to_csv(dataframe):
604
- return dataframe.to_csv(index=False).encode('utf-8')
605
-
606
- csv_data = convert_df_to_csv(filtered_df)
607
- st.download_button(
608
- label="Download Filtered Results",
609
- data=csv_data,
610
- file_name="filtered_leaderboard.csv",
611
- mime="text/csv"
612
- )
613
 
614
 
615
 
 
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
 
 
473
 
474
 
475
 
476
+ # import streamlit as st
477
+ # import pandas as pd
478
+ # import altair as alt
479
 
480
+ # # Set page layout to wide mode
481
+ # st.set_page_config(
482
+ # page_title="PathVLMs Leaderboard",
483
+ # page_icon="🏆",
484
+ # layout="wide"
485
+ # )
486
 
487
+ # # Load the leaderboard data
488
+ # df = pd.read_csv("leaderboard.csv")
489
 
490
+ # # Add custom CSS for alignment
491
+ # st.markdown(
492
+ # """
493
+ # <style>
494
+ # .centered {
495
+ # display: flex;
496
+ # justify-content: center;
497
+ # align-items: center;
498
+ # flex-direction: column;
499
+ # }
500
+ # .search-bar {
501
+ # width: 60%;
502
+ # margin-bottom: 20px;
503
+ # }
504
+ # </style>
505
+ # """,
506
+ # unsafe_allow_html=True
507
+ # )
508
 
509
+ # # Add title and description
510
+ # st.title("PathVLMs Leaderboard 🏆")
511
+ # st.markdown("""
512
+ # Welcome to the **PathVLMs Leaderboard**! This leaderboard displays evaluation results for various models in Pathology Language-Model-based Methods (LMMs).
513
+ # You can search, filter, and visualize metrics for better insights.
514
+ # """)
515
 
516
+ # # Create a layout with two columns: main content (left) and filters (right)
517
+ # col1, col2 = st.columns([4, 1]) # Adjust column ratio
518
 
519
+ # # Filters on the right
520
+ # with col2:
521
+ # st.subheader("Filters")
522
 
523
+ # # Search by model name
524
+ # search_query = st.text_input(
525
+ # "Search for Model Name",
526
+ # value="",
527
+ # placeholder="e.g., llava",
528
+ # key="search_bar",
529
+ # help="Enter part of a model name to filter the leaderboard.",
530
+ # )
531
 
532
+ # # Filter by model size
533
+ # model_sizes = df['Params (B)'].unique()
534
+ # selected_sizes = st.multiselect(
535
+ # "Select Model Sizes",
536
+ # options=model_sizes,
537
+ # default=model_sizes
538
+ # )
539
 
540
+ # # Filter by model type (if applicable)
541
+ # if 'Language Model' in df.columns:
542
+ # model_types = df['Language Model'].unique()
543
+ # selected_types = st.multiselect(
544
+ # "Select Model Types",
545
+ # options=model_types,
546
+ # default=model_types
547
+ # )
548
+ # else:
549
+ # selected_types = []
550
 
551
+ # # Main content on the left
552
+ # with col1:
553
+ # # Apply filters to the DataFrame
554
+ # filtered_df = df[
555
+ # (df['Params (B)'].isin(selected_sizes)) &
556
+ # (df['Language Model'].isin(selected_types) if selected_types else True) &
557
+ # (df['Method'].str.contains(search_query, case=False, na=False))
558
+ # ]
559
+
560
+ # # Warning if no results
561
+ # if filtered_df.empty:
562
+ # st.warning("No results found. Try adjusting the filters.")
563
+ # else:
564
+ # # Display the filtered leaderboard table
565
+ # st.markdown('<div class="centered">', unsafe_allow_html=True)
566
+ # st.subheader("Leaderboard Table")
567
+ # st.dataframe(filtered_df, height=600, width=1400) # Adjust table size
568
+ # st.markdown('</div>', unsafe_allow_html=True)
569
+
570
+ # # Visualization Section
571
+ # st.subheader("Performance Metrics Visualization")
572
+ # metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
573
+
574
+ # chart = alt.Chart(filtered_df).mark_bar().encode(
575
+ # x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
576
+ # y=alt.Y(metric, title=metric),
577
+ # color='Method',
578
+ # tooltip=['Method', metric]
579
+ # ).properties(
580
+ # width=1000, # Adjust chart width
581
+ # height=500 # Adjust chart height
582
+ # )
583
+ # st.altair_chart(chart, use_container_width=True)
584
+
585
+ # # Highlight Top N Models
586
+ # st.subheader("Highlight Top N Models")
587
+ # top_n = st.slider("Number of Top Models", min_value=1, max_value=len(filtered_df), value=5)
588
+ # top_models_df = filtered_df.nlargest(top_n, metric)
589
+
590
+ # top_chart = alt.Chart(top_models_df).mark_bar().encode(
591
+ # x=alt.X('Method', title="Model"),
592
+ # y=alt.Y(metric, title=metric),
593
+ # color='Method',
594
+ # tooltip=['Method', metric]
595
+ # ).properties(
596
+ # width=1000,
597
+ # height=400
598
+ # )
599
+ # st.altair_chart(top_chart, use_container_width=True)
600
+
601
+ # # Download Button
602
+ # @st.cache
603
+ # def convert_df_to_csv(dataframe):
604
+ # return dataframe.to_csv(index=False).encode('utf-8')
605
+
606
+ # csv_data = convert_df_to_csv(filtered_df)
607
+ # st.download_button(
608
+ # label="Download Filtered Results",
609
+ # data=csv_data,
610
+ # file_name="filtered_leaderboard.csv",
611
+ # mime="text/csv"
612
+ # )
613
 
614
 
615