Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,6 +104,129 @@
|
|
| 104 |
|
| 105 |
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
import streamlit as st
|
| 108 |
import pandas as pd
|
| 109 |
import altair as alt
|
|
@@ -116,7 +239,7 @@ st.set_page_config(
|
|
| 116 |
)
|
| 117 |
|
| 118 |
# Load the leaderboard data
|
| 119 |
-
df = pd.read_csv("leaderboard.csv")
|
| 120 |
|
| 121 |
# Add title and description
|
| 122 |
st.title("PathVLMs Leaderboard 🏆")
|
|
@@ -128,7 +251,7 @@ You can search, filter, and visualize metrics for better insights.
|
|
| 128 |
# Sidebar Filters
|
| 129 |
with st.sidebar:
|
| 130 |
st.subheader("Filters")
|
| 131 |
-
# Search by model name
|
| 132 |
search_query = st.text_input("Search for Model Name", value="", placeholder="e.g., llava")
|
| 133 |
|
| 134 |
# Filter by model size
|
|
@@ -154,61 +277,26 @@ st.subheader("Leaderboard Table")
|
|
| 154 |
if filtered_df.empty:
|
| 155 |
st.warning("No results found. Try adjusting the filters.")
|
| 156 |
else:
|
| 157 |
-
# Display
|
| 158 |
-
st.dataframe(
|
| 159 |
-
filtered_df,
|
| 160 |
-
height=600, # Adjust table height
|
| 161 |
-
width=1600 # Adjust table width
|
| 162 |
-
)
|
| 163 |
|
| 164 |
-
#
|
| 165 |
-
|
| 166 |
-
metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
|
| 167 |
-
|
| 168 |
-
# Visualization Chart
|
| 169 |
-
chart = alt.Chart(filtered_df).mark_bar().encode(
|
| 170 |
-
x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
|
| 171 |
-
y=alt.Y(metric, title=metric),
|
| 172 |
-
color='Method',
|
| 173 |
-
tooltip=['Method', metric]
|
| 174 |
-
).properties(
|
| 175 |
-
width=1400, # Full width
|
| 176 |
-
height=600 # Increased height
|
| 177 |
-
)
|
| 178 |
-
st.altair_chart(chart, use_container_width=True)
|
| 179 |
|
| 180 |
-
# Bubble
|
| 181 |
-
|
| 182 |
-
|
| 183 |
bubble_chart = alt.Chart(filtered_df).mark_circle(size=200).encode(
|
| 184 |
x=alt.X('Params (B):Q', title="Model Size (in Billion Params)"),
|
| 185 |
-
y=alt.Y('
|
| 186 |
size=alt.Size('Params (B):Q', legend=None),
|
| 187 |
color=alt.Color('Method:N', title="Model"),
|
| 188 |
-
tooltip=['Method', '
|
| 189 |
).properties(
|
| 190 |
width=800,
|
| 191 |
height=600
|
| 192 |
)
|
| 193 |
st.altair_chart(bubble_chart, use_container_width=True)
|
| 194 |
-
else:
|
| 195 |
-
st.warning("Columns 'Accuracy' and 'Params (B)' are required for the bubble plot.")
|
| 196 |
-
|
| 197 |
-
# Highlight Top N Models
|
| 198 |
-
st.subheader("Highlight Top N Models")
|
| 199 |
-
top_n = st.slider("Number of Top Models", min_value=1, max_value=len(filtered_df), value=5)
|
| 200 |
-
top_models_df = filtered_df.nlargest(top_n, metric)
|
| 201 |
-
|
| 202 |
-
top_chart = alt.Chart(top_models_df).mark_bar().encode(
|
| 203 |
-
x=alt.X('Method', title="Model"),
|
| 204 |
-
y=alt.Y(metric, title=metric),
|
| 205 |
-
color='Method',
|
| 206 |
-
tooltip=['Method', metric]
|
| 207 |
-
).properties(
|
| 208 |
-
width=1400, # Full width
|
| 209 |
-
height=400 # Adjusted height for smaller chart
|
| 210 |
-
)
|
| 211 |
-
st.altair_chart(top_chart, use_container_width=True)
|
| 212 |
|
| 213 |
# Download Button
|
| 214 |
@st.cache
|
|
@@ -224,3 +312,4 @@ else:
|
|
| 224 |
)
|
| 225 |
|
| 226 |
|
|
|
|
|
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
+
# import streamlit as st
|
| 108 |
+
# import pandas as pd
|
| 109 |
+
# import altair as alt
|
| 110 |
+
|
| 111 |
+
# # Set page layout to wide mode
|
| 112 |
+
# st.set_page_config(
|
| 113 |
+
# page_title="PathVLMs Leaderboard",
|
| 114 |
+
# page_icon="🏆",
|
| 115 |
+
# layout="wide"
|
| 116 |
+
# )
|
| 117 |
+
|
| 118 |
+
# # Load the leaderboard data
|
| 119 |
+
# df = pd.read_csv("leaderboard.csv")
|
| 120 |
+
|
| 121 |
+
# # Add title and description
|
| 122 |
+
# st.title("PathVLMs Leaderboard 🏆")
|
| 123 |
+
# st.markdown("""
|
| 124 |
+
# 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.
|
| 125 |
+
# You can search, filter, and visualize metrics for better insights.
|
| 126 |
+
# """)
|
| 127 |
+
|
| 128 |
+
# # Sidebar Filters
|
| 129 |
+
# with st.sidebar:
|
| 130 |
+
# st.subheader("Filters")
|
| 131 |
+
# # Search by model name (fuzzy search)
|
| 132 |
+
# search_query = st.text_input("Search for Model Name", value="", placeholder="e.g., llava")
|
| 133 |
+
|
| 134 |
+
# # Filter by model size
|
| 135 |
+
# model_sizes = df['Params (B)'].unique()
|
| 136 |
+
# selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
|
| 137 |
+
|
| 138 |
+
# # Filter by model type
|
| 139 |
+
# if 'Language Model' in df.columns:
|
| 140 |
+
# model_types = df['Language Model'].unique()
|
| 141 |
+
# selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
|
| 142 |
+
# else:
|
| 143 |
+
# selected_types = []
|
| 144 |
+
|
| 145 |
+
# # Apply Filters
|
| 146 |
+
# filtered_df = df[
|
| 147 |
+
# (df['Params (B)'].isin(selected_sizes)) &
|
| 148 |
+
# (df['Language Model'].isin(selected_types) if selected_types else True) &
|
| 149 |
+
# (df['Method'].str.contains(search_query, case=False, na=False))
|
| 150 |
+
# ]
|
| 151 |
+
|
| 152 |
+
# # Main Leaderboard Section
|
| 153 |
+
# st.subheader("Leaderboard Table")
|
| 154 |
+
# if filtered_df.empty:
|
| 155 |
+
# st.warning("No results found. Try adjusting the filters.")
|
| 156 |
+
# else:
|
| 157 |
+
# # Display table in wide layout
|
| 158 |
+
# st.dataframe(
|
| 159 |
+
# filtered_df,
|
| 160 |
+
# height=600, # Adjust table height
|
| 161 |
+
# width=1600 # Adjust table width
|
| 162 |
+
# )
|
| 163 |
+
|
| 164 |
+
# # Visualization of selected metric
|
| 165 |
+
# st.subheader("Performance Metrics Visualization")
|
| 166 |
+
# metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
|
| 167 |
+
|
| 168 |
+
# # Visualization Chart
|
| 169 |
+
# chart = alt.Chart(filtered_df).mark_bar().encode(
|
| 170 |
+
# x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
|
| 171 |
+
# y=alt.Y(metric, title=metric),
|
| 172 |
+
# color='Method',
|
| 173 |
+
# tooltip=['Method', metric]
|
| 174 |
+
# ).properties(
|
| 175 |
+
# width=1400, # Full width
|
| 176 |
+
# height=600 # Increased height
|
| 177 |
+
# )
|
| 178 |
+
# st.altair_chart(chart, use_container_width=True)
|
| 179 |
+
|
| 180 |
+
# # Bubble Plot for Accuracy vs. Model Size
|
| 181 |
+
# st.subheader("Bubble Plot: Accuracy vs. Model Size")
|
| 182 |
+
# if 'Avg score' in filtered_df.columns and 'Params (B)' in filtered_df.columns:
|
| 183 |
+
# bubble_chart = alt.Chart(filtered_df).mark_circle(size=200).encode(
|
| 184 |
+
# x=alt.X('Params (B):Q', title="Model Size (in Billion Params)"),
|
| 185 |
+
# y=alt.Y('Avg score:Q', title="Avg score"),
|
| 186 |
+
# size=alt.Size('Params (B):Q', legend=None),
|
| 187 |
+
# color=alt.Color('Method:N', title="Model"),
|
| 188 |
+
# tooltip=['Method', 'Avg score', 'Params (B)']
|
| 189 |
+
# ).properties(
|
| 190 |
+
# width=800,
|
| 191 |
+
# height=600
|
| 192 |
+
# )
|
| 193 |
+
# st.altair_chart(bubble_chart, use_container_width=True)
|
| 194 |
+
# else:
|
| 195 |
+
# st.warning("Columns 'Accuracy' and 'Params (B)' are required for the bubble plot.")
|
| 196 |
+
|
| 197 |
+
# # Highlight Top N Models
|
| 198 |
+
# st.subheader("Highlight Top N Models")
|
| 199 |
+
# top_n = st.slider("Number of Top Models", min_value=1, max_value=len(filtered_df), value=5)
|
| 200 |
+
# top_models_df = filtered_df.nlargest(top_n, metric)
|
| 201 |
+
|
| 202 |
+
# top_chart = alt.Chart(top_models_df).mark_bar().encode(
|
| 203 |
+
# x=alt.X('Method', title="Model"),
|
| 204 |
+
# y=alt.Y(metric, title=metric),
|
| 205 |
+
# color='Method',
|
| 206 |
+
# tooltip=['Method', metric]
|
| 207 |
+
# ).properties(
|
| 208 |
+
# width=1400, # Full width
|
| 209 |
+
# height=400 # Adjusted height for smaller chart
|
| 210 |
+
# )
|
| 211 |
+
# st.altair_chart(top_chart, use_container_width=True)
|
| 212 |
+
|
| 213 |
+
# # Download Button
|
| 214 |
+
# @st.cache
|
| 215 |
+
# def convert_df_to_csv(dataframe):
|
| 216 |
+
# return dataframe.to_csv(index=False).encode('utf-8')
|
| 217 |
+
|
| 218 |
+
# csv_data = convert_df_to_csv(filtered_df)
|
| 219 |
+
# st.download_button(
|
| 220 |
+
# label="Download Filtered Results",
|
| 221 |
+
# data=csv_data,
|
| 222 |
+
# file_name="filtered_leaderboard.csv",
|
| 223 |
+
# mime="text/csv"
|
| 224 |
+
# )
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
|
| 230 |
import streamlit as st
|
| 231 |
import pandas as pd
|
| 232 |
import altair as alt
|
|
|
|
| 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 🏆")
|
|
|
|
| 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
|
|
|
|
| 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
|
|
|
|
| 312 |
)
|
| 313 |
|
| 314 |
|
| 315 |
+
|