hassonofer commited on
Commit
08ec329
·
1 Parent(s): e927422

Add model count

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -184,7 +184,7 @@ def plot_acc_rate(rate_compare_results_df: pl.DataFrame, width: int = 1000, heig
184
 
185
  def update_data(
186
  dataset: str, benchmark: str, intermediate: bool, mim: bool, ssl: bool, dist: bool, log_x: bool, search_bar: str
187
- ) -> tuple[alt.LayerChart, pl.DataFrame]:
188
  compare_results_df = pl.read_csv(f"results_{dataset}.csv")
189
  if intermediate is False:
190
  compare_results_df = compare_results_df.filter(pl.col("Intermediate") == intermediate)
@@ -262,7 +262,9 @@ def update_data(
262
  ]
263
  )
264
 
265
- return (chart, output_df.drop("Mistakes", "Samples", "torch_version"))
 
 
266
 
267
 
268
  def app() -> None:
@@ -340,13 +342,13 @@ def app() -> None:
340
  search_bar = gr.Textbox(label="Model Filter", placeholder="e.g. convnext, efficient|mobile")
341
 
342
  with gr.Column():
343
- pass
344
 
345
  plot = gr.Plot(container=False)
346
  table = gr.Dataframe(show_search="search")
347
 
348
  inputs = [dataset_dropdown, benchmark_dropdown, intermediate, mim, ssl, dist, log_x, search_bar]
349
- outputs = [plot, table]
350
  leaderboard.load(update_data, inputs=inputs, outputs=outputs)
351
 
352
  dataset_dropdown.change(update_data, inputs=inputs, outputs=outputs)
 
184
 
185
  def update_data(
186
  dataset: str, benchmark: str, intermediate: bool, mim: bool, ssl: bool, dist: bool, log_x: bool, search_bar: str
187
+ ) -> tuple[alt.LayerChart, pl.DataFrame, str]:
188
  compare_results_df = pl.read_csv(f"results_{dataset}.csv")
189
  if intermediate is False:
190
  compare_results_df = compare_results_df.filter(pl.col("Intermediate") == intermediate)
 
262
  ]
263
  )
264
 
265
+ model_count_text = f"{len(output_df)} models displayed"
266
+
267
+ return (chart, output_df.drop("Mistakes", "Samples", "torch_version"), model_count_text)
268
 
269
 
270
  def app() -> None:
 
342
  search_bar = gr.Textbox(label="Model Filter", placeholder="e.g. convnext, efficient|mobile")
343
 
344
  with gr.Column():
345
+ model_count_display = gr.Markdown()
346
 
347
  plot = gr.Plot(container=False)
348
  table = gr.Dataframe(show_search="search")
349
 
350
  inputs = [dataset_dropdown, benchmark_dropdown, intermediate, mim, ssl, dist, log_x, search_bar]
351
+ outputs = [plot, table, model_count_display]
352
  leaderboard.load(update_data, inputs=inputs, outputs=outputs)
353
 
354
  dataset_dropdown.change(update_data, inputs=inputs, outputs=outputs)