Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,7 +102,8 @@
|
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
-
#
|
|
|
|
| 106 |
|
| 107 |
import streamlit as st
|
| 108 |
import pandas as pd
|
|
@@ -177,22 +178,24 @@ else:
|
|
| 177 |
)
|
| 178 |
st.altair_chart(chart, use_container_width=True)
|
| 179 |
|
| 180 |
-
# Bubble Plot
|
| 181 |
-
st.subheader("Bubble Plot:
|
| 182 |
-
|
| 183 |
-
|
|
|
|
|
|
|
| 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(
|
| 194 |
else:
|
| 195 |
-
st.warning("Columns '
|
| 196 |
|
| 197 |
# Highlight Top N Models
|
| 198 |
st.subheader("Highlight Top N Models")
|
|
@@ -224,6 +227,129 @@ else:
|
|
| 224 |
)
|
| 225 |
|
| 226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
# with all bubble plot
|
| 228 |
|
| 229 |
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
+
# interactive Bubble plot
|
| 106 |
+
|
| 107 |
|
| 108 |
import streamlit as st
|
| 109 |
import pandas as pd
|
|
|
|
| 178 |
)
|
| 179 |
st.altair_chart(chart, use_container_width=True)
|
| 180 |
|
| 181 |
+
# Interactive Bubble Plot: Metric vs. Model Size
|
| 182 |
+
st.subheader("Interactive Bubble Plot: Metric vs. Model Size")
|
| 183 |
+
bubble_metric = st.selectbox("Select Metric for Bubble Plot", options=filtered_df.columns[5:], index=0)
|
| 184 |
+
|
| 185 |
+
if bubble_metric in filtered_df.columns and 'Params (B)' in filtered_df.columns:
|
| 186 |
+
interactive_bubble_chart = alt.Chart(filtered_df).mark_circle(size=200).encode(
|
| 187 |
x=alt.X('Params (B):Q', title="Model Size (in Billion Params)"),
|
| 188 |
+
y=alt.Y(f'{bubble_metric}:Q', title=bubble_metric),
|
| 189 |
size=alt.Size('Params (B):Q', legend=None),
|
| 190 |
color=alt.Color('Method:N', title="Model"),
|
| 191 |
+
tooltip=['Method', 'Params (B)', bubble_metric]
|
| 192 |
).properties(
|
| 193 |
width=800,
|
| 194 |
height=600
|
| 195 |
)
|
| 196 |
+
st.altair_chart(interactive_bubble_chart, use_container_width=True)
|
| 197 |
else:
|
| 198 |
+
st.warning(f"Columns '{bubble_metric}' and 'Params (B)' are required for the bubble plot.")
|
| 199 |
|
| 200 |
# Highlight Top N Models
|
| 201 |
st.subheader("Highlight Top N Models")
|
|
|
|
| 227 |
)
|
| 228 |
|
| 229 |
|
| 230 |
+
|
| 231 |
+
# with bubble plot
|
| 232 |
+
|
| 233 |
+
# import streamlit as st
|
| 234 |
+
# import pandas as pd
|
| 235 |
+
# import altair as alt
|
| 236 |
+
|
| 237 |
+
# # Set page layout to wide mode
|
| 238 |
+
# st.set_page_config(
|
| 239 |
+
# page_title="PathVLMs Leaderboard",
|
| 240 |
+
# page_icon="🏆",
|
| 241 |
+
# layout="wide"
|
| 242 |
+
# )
|
| 243 |
+
|
| 244 |
+
# # Load the leaderboard data
|
| 245 |
+
# df = pd.read_csv("leaderboard.csv")
|
| 246 |
+
|
| 247 |
+
# # Add title and description
|
| 248 |
+
# st.title("PathVLMs Leaderboard 🏆")
|
| 249 |
+
# st.markdown("""
|
| 250 |
+
# 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.
|
| 251 |
+
# You can search, filter, and visualize metrics for better insights.
|
| 252 |
+
# """)
|
| 253 |
+
|
| 254 |
+
# # Sidebar Filters
|
| 255 |
+
# with st.sidebar:
|
| 256 |
+
# st.subheader("Filters")
|
| 257 |
+
# # Search by model name (fuzzy search)
|
| 258 |
+
# search_query = st.text_input("Search for Model Name", value="", placeholder="e.g., llava")
|
| 259 |
+
|
| 260 |
+
# # Filter by model size
|
| 261 |
+
# model_sizes = df['Params (B)'].unique()
|
| 262 |
+
# selected_sizes = st.multiselect("Select Model Sizes", options=model_sizes, default=model_sizes)
|
| 263 |
+
|
| 264 |
+
# # Filter by model type
|
| 265 |
+
# if 'Language Model' in df.columns:
|
| 266 |
+
# model_types = df['Language Model'].unique()
|
| 267 |
+
# selected_types = st.multiselect("Select Model Types", options=model_types, default=model_types)
|
| 268 |
+
# else:
|
| 269 |
+
# selected_types = []
|
| 270 |
+
|
| 271 |
+
# # Apply Filters
|
| 272 |
+
# filtered_df = df[
|
| 273 |
+
# (df['Params (B)'].isin(selected_sizes)) &
|
| 274 |
+
# (df['Language Model'].isin(selected_types) if selected_types else True) &
|
| 275 |
+
# (df['Method'].str.contains(search_query, case=False, na=False))
|
| 276 |
+
# ]
|
| 277 |
+
|
| 278 |
+
# # Main Leaderboard Section
|
| 279 |
+
# st.subheader("Leaderboard Table")
|
| 280 |
+
# if filtered_df.empty:
|
| 281 |
+
# st.warning("No results found. Try adjusting the filters.")
|
| 282 |
+
# else:
|
| 283 |
+
# # Display table in wide layout
|
| 284 |
+
# st.dataframe(
|
| 285 |
+
# filtered_df,
|
| 286 |
+
# height=600, # Adjust table height
|
| 287 |
+
# width=1600 # Adjust table width
|
| 288 |
+
# )
|
| 289 |
+
|
| 290 |
+
# # Visualization of selected metric
|
| 291 |
+
# st.subheader("Performance Metrics Visualization")
|
| 292 |
+
# metric = st.selectbox("Select Metric to Visualize", options=filtered_df.columns[5:])
|
| 293 |
+
|
| 294 |
+
# # Visualization Chart
|
| 295 |
+
# chart = alt.Chart(filtered_df).mark_bar().encode(
|
| 296 |
+
# x=alt.X('Method', sort=alt.EncodingSortField(field=metric, order='descending'), title="Model"),
|
| 297 |
+
# y=alt.Y(metric, title=metric),
|
| 298 |
+
# color='Method',
|
| 299 |
+
# tooltip=['Method', metric]
|
| 300 |
+
# ).properties(
|
| 301 |
+
# width=1400, # Full width
|
| 302 |
+
# height=600 # Increased height
|
| 303 |
+
# )
|
| 304 |
+
# st.altair_chart(chart, use_container_width=True)
|
| 305 |
+
|
| 306 |
+
# # Bubble Plot for Accuracy vs. Model Size
|
| 307 |
+
# st.subheader("Bubble Plot: Accuracy vs. Model Size")
|
| 308 |
+
# if 'Avg score' in filtered_df.columns and 'Params (B)' in filtered_df.columns:
|
| 309 |
+
# bubble_chart = alt.Chart(filtered_df).mark_circle(size=200).encode(
|
| 310 |
+
# x=alt.X('Params (B):Q', title="Model Size (in Billion Params)"),
|
| 311 |
+
# y=alt.Y('Avg score:Q', title="Avg score"),
|
| 312 |
+
# size=alt.Size('Params (B):Q', legend=None),
|
| 313 |
+
# color=alt.Color('Method:N', title="Model"),
|
| 314 |
+
# tooltip=['Method', 'Avg score', 'Params (B)']
|
| 315 |
+
# ).properties(
|
| 316 |
+
# width=800,
|
| 317 |
+
# height=600
|
| 318 |
+
# )
|
| 319 |
+
# st.altair_chart(bubble_chart, use_container_width=True)
|
| 320 |
+
# else:
|
| 321 |
+
# st.warning("Columns 'Accuracy' and 'Params (B)' are required for the bubble plot.")
|
| 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 |
# with all bubble plot
|
| 354 |
|
| 355 |
|