davidberenstein1957 commited on
Commit
a538c9d
·
1 Parent(s): e82e1f8

refactor: simplify leaderboard configuration in app.py by removing unnecessary filters and adjusting data type handling for improved performance and clarity

Browse files
Files changed (1) hide show
  1. app.py +3 -26
app.py CHANGED
@@ -1,13 +1,13 @@
1
  import json
2
- import math
3
  from pathlib import Path
4
 
5
  import gradio as gr
6
  import pandas as pd
7
- from gradio_leaderboard import ColumnFilter, Leaderboard
8
 
9
  from assets import custom_css
10
 
 
11
  abs_path = Path(__file__).parent
12
 
13
  # Load the JSONL file into a pandas DataFrame using the json library
@@ -38,34 +38,11 @@ with gr.Blocks("ParityError/Interstellar", fill_width=True, css=custom_css) as d
38
  </div>
39
  """
40
  )
41
-
42
  with gr.Tabs():
43
  with gr.TabItem("FLUX.1 [dev] Leaderboard"):
44
- median_inference_time_min = math.floor(float(df["Median Inference Time"].min()))
45
- median_inference_time_max = math.ceil(float(df["Median Inference Time"].max()))
46
- price_per_image_min = math.floor(float(df["Price per Image"].min()))
47
- price_per_image_max = math.ceil(float(df["Price per Image"].max()))
48
  Leaderboard(
49
  value=df,
50
- search_columns=["Model"],
51
- filter_columns=[
52
- ColumnFilter(
53
- column="Median Inference Time",
54
- type="slider",
55
- default=[median_inference_time_min, median_inference_time_max],
56
- min=median_inference_time_min,
57
- max=median_inference_time_max,
58
- ),
59
- ColumnFilter(
60
- column="Price per Image",
61
- type="slider",
62
- default=[price_per_image_min, price_per_image_max],
63
- min=price_per_image_min,
64
- max=price_per_image_max,
65
- ),
66
- ],
67
- select_columns=df.columns.tolist(),
68
- datatype="markdown",
69
  )
70
  with gr.TabItem("FLUX.1 [dev] examples"):
71
  gr.HTML(
 
1
  import json
 
2
  from pathlib import Path
3
 
4
  import gradio as gr
5
  import pandas as pd
6
+ from gradio_leaderboard import Leaderboard
7
 
8
  from assets import custom_css
9
 
10
+ Leaderboard.raise_error_if_incorrect_config = lambda self: None
11
  abs_path = Path(__file__).parent
12
 
13
  # Load the JSONL file into a pandas DataFrame using the json library
 
38
  </div>
39
  """
40
  )
 
41
  with gr.Tabs():
42
  with gr.TabItem("FLUX.1 [dev] Leaderboard"):
 
 
 
 
43
  Leaderboard(
44
  value=df,
45
+ datatype=["markdown"] + ["number"] * (len(df.columns.tolist()) - 1),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  )
47
  with gr.TabItem("FLUX.1 [dev] examples"):
48
  gr.HTML(