Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,7 +102,7 @@
|
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
# import streamlit as st
|
| 108 |
# import pandas as pd
|
|
@@ -224,8 +224,96 @@
|
|
| 224 |
# )
|
| 225 |
|
| 226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
|
|
|
|
| 229 |
|
| 230 |
import streamlit as st
|
| 231 |
import pandas as pd
|
|
@@ -239,7 +327,7 @@ st.set_page_config(
|
|
| 239 |
)
|
| 240 |
|
| 241 |
# Load the leaderboard data
|
| 242 |
-
df = pd.read_csv("leaderboard.csv") # Replace with
|
| 243 |
|
| 244 |
# Add title and description
|
| 245 |
st.title("PathVLMs Leaderboard 🏆")
|
|
@@ -277,8 +365,28 @@ st.subheader("Leaderboard Table")
|
|
| 277 |
if filtered_df.empty:
|
| 278 |
st.warning("No results found. Try adjusting the filters.")
|
| 279 |
else:
|
| 280 |
-
# Display
|
| 281 |
-
st.dataframe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
|
| 283 |
# Dataset columns to plot
|
| 284 |
dataset_columns = ['Socialpath Tiny', 'Socialpath All', 'Education Content Tiny', 'Education Content All', 'Pubmed Tiny', 'Pubmed All', 'Avg score']
|
|
@@ -313,3 +421,4 @@ else:
|
|
| 313 |
|
| 314 |
|
| 315 |
|
|
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
+
# with bubble plot
|
| 106 |
|
| 107 |
# import streamlit as st
|
| 108 |
# import pandas as pd
|
|
|
|
| 224 |
# )
|
| 225 |
|
| 226 |
|
| 227 |
+
# with all bubble plot
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
# import streamlit as st
|
| 231 |
+
# import pandas as pd
|
| 232 |
+
# import altair as alt
|
| 233 |
+
|
| 234 |
+
# # Set page layout to wide mode
|
| 235 |
+
# st.set_page_config(
|
| 236 |
+
# page_title="PathVLMs Leaderboard",
|
| 237 |
+
# page_icon="🏆",
|
| 238 |
+
# layout="wide"
|
| 239 |
+
# )
|
| 240 |
+
|
| 241 |
+
# # Load the leaderboard data
|
| 242 |
+
# df = pd.read_csv("leaderboard.csv") # Replace with the actual filename
|
| 243 |
+
|
| 244 |
+
# # Add title and description
|
| 245 |
+
# st.title("PathVLMs Leaderboard 🏆")
|
| 246 |
+
# st.markdown("""
|
| 247 |
+
# Welcome to the **PathVLMs Leaderboard**! This leaderboard displays evaluation results for various Vision-Language Models (VLMs) in Pathology, focusing on multiple-choice questions (MCQs), answers, and explanations.
|
| 248 |
+
# You can search, filter, and visualize metrics for better insights.
|
| 249 |
+
# """)
|
| 250 |
+
|
| 251 |
+
# # Sidebar Filters
|
| 252 |
+
# with st.sidebar:
|
| 253 |
+
# st.subheader("Filters")
|
| 254 |
+
# # Search by model name
|
| 255 |
+
# search_query = st.text_input("Search for Model Name", value="", placeholder="e.g., llava")
|
| 256 |
+
|
| 257 |
+
# # Filter by model size
|
| 258 |
+
# model_sizes = df['Params (B)'].unique()
|
| 259 |
+
# selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
|
| 260 |
+
|
| 261 |
+
# # Filter by model type
|
| 262 |
+
# if 'Language Model' in df.columns:
|
| 263 |
+
# model_types = df['Language Model'].unique()
|
| 264 |
+
# selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
|
| 265 |
+
# else:
|
| 266 |
+
# selected_types = []
|
| 267 |
+
|
| 268 |
+
# # Apply Filters
|
| 269 |
+
# filtered_df = df[
|
| 270 |
+
# (df['Params (B)'].isin(selected_sizes)) &
|
| 271 |
+
# (df['Language Model'].isin(selected_types) if selected_types else True) &
|
| 272 |
+
# (df['Method'].str.contains(search_query, case=False, na=False))
|
| 273 |
+
# ]
|
| 274 |
+
|
| 275 |
+
# # Main Leaderboard Section
|
| 276 |
+
# st.subheader("Leaderboard Table")
|
| 277 |
+
# if filtered_df.empty:
|
| 278 |
+
# st.warning("No results found. Try adjusting the filters.")
|
| 279 |
+
# else:
|
| 280 |
+
# # Display the filtered table
|
| 281 |
+
# st.dataframe(filtered_df)
|
| 282 |
+
|
| 283 |
+
# # Dataset columns to plot
|
| 284 |
+
# dataset_columns = ['Socialpath Tiny', 'Socialpath All', 'Education Content Tiny', 'Education Content All', 'Pubmed Tiny', 'Pubmed All', 'Avg score']
|
| 285 |
+
|
| 286 |
+
# # Generate Bubble Plots for each dataset column
|
| 287 |
+
# for dataset in dataset_columns:
|
| 288 |
+
# st.subheader(f"Bubble Plot: {dataset}")
|
| 289 |
+
# bubble_chart = alt.Chart(filtered_df).mark_circle(size=200).encode(
|
| 290 |
+
# x=alt.X('Params (B):Q', title="Model Size (in Billion Params)"),
|
| 291 |
+
# y=alt.Y(f'{dataset}:Q', title=dataset),
|
| 292 |
+
# size=alt.Size('Params (B):Q', legend=None),
|
| 293 |
+
# color=alt.Color('Method:N', title="Model"),
|
| 294 |
+
# tooltip=['Method', 'Params (B)', dataset]
|
| 295 |
+
# ).properties(
|
| 296 |
+
# width=800,
|
| 297 |
+
# height=600
|
| 298 |
+
# )
|
| 299 |
+
# st.altair_chart(bubble_chart, use_container_width=True)
|
| 300 |
+
|
| 301 |
+
# # Download Button
|
| 302 |
+
# @st.cache
|
| 303 |
+
# def convert_df_to_csv(dataframe):
|
| 304 |
+
# return dataframe.to_csv(index=False).encode('utf-8')
|
| 305 |
+
|
| 306 |
+
# csv_data = convert_df_to_csv(filtered_df)
|
| 307 |
+
# st.download_button(
|
| 308 |
+
# label="Download Filtered Results",
|
| 309 |
+
# data=csv_data,
|
| 310 |
+
# file_name="filtered_leaderboard.csv",
|
| 311 |
+
# mime="text/csv"
|
| 312 |
+
# )
|
| 313 |
+
|
| 314 |
|
| 315 |
|
| 316 |
+
# this also with bubble
|
| 317 |
|
| 318 |
import streamlit as st
|
| 319 |
import pandas as pd
|
|
|
|
| 327 |
)
|
| 328 |
|
| 329 |
# Load the leaderboard data
|
| 330 |
+
df = pd.read_csv("leaderboard.csv") # Replace with your actual CSV file name
|
| 331 |
|
| 332 |
# Add title and description
|
| 333 |
st.title("PathVLMs Leaderboard 🏆")
|
|
|
|
| 365 |
if filtered_df.empty:
|
| 366 |
st.warning("No results found. Try adjusting the filters.")
|
| 367 |
else:
|
| 368 |
+
# Display table in wide layout
|
| 369 |
+
st.dataframe(
|
| 370 |
+
filtered_df,
|
| 371 |
+
height=600, # Adjust table height
|
| 372 |
+
width=1600 # Adjust table width
|
| 373 |
+
)
|
| 374 |
+
|
| 375 |
+
# Visualization of selected metric
|
| 376 |
+
st.subheader("Performance Metrics Visualization")
|
| 377 |
+
metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
|
| 378 |
+
|
| 379 |
+
# Visualization Chart
|
| 380 |
+
chart = alt.Chart(filtered_df).mark_bar().encode(
|
| 381 |
+
x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
|
| 382 |
+
y=alt.Y(metric, title=metric),
|
| 383 |
+
color='Method',
|
| 384 |
+
tooltip=['Method', metric]
|
| 385 |
+
).properties(
|
| 386 |
+
width=1400, # Full width
|
| 387 |
+
height=600 # Increased height
|
| 388 |
+
)
|
| 389 |
+
st.altair_chart(chart, use_container_width=True)
|
| 390 |
|
| 391 |
# Dataset columns to plot
|
| 392 |
dataset_columns = ['Socialpath Tiny', 'Socialpath All', 'Education Content Tiny', 'Education Content All', 'Pubmed Tiny', 'Pubmed All', 'Avg score']
|
|
|
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
+
|