ggcristian commited on
Commit
6db8de6
·
1 Parent(s): 0548509

Small refactor: Add `config` with model metadata and move constants to its own file

Browse files
Files changed (2) hide show
  1. app.py +1 -26
  2. data_processing.py +26 -0
app.py CHANGED
@@ -6,7 +6,7 @@ from gradio.themes.utils import colors
6
  from config import constants as C
7
  from handlers.leaderboard_handlers import create_leaderboard_handlers
8
  from results.parse import get_metadata, parse_agg, read_dataframe
9
- from data_processing import filter_leaderboard, generate_scatter_plot
10
  from static.about import CITATION_BUTTON_LABEL, CITATION_BUTTON_TEXT
11
  from static.html_content import (
12
  ABOUT_US_HTML,
@@ -175,31 +175,6 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Default(primary_hue=colors.emeral
175
  )
176
 
177
 
178
- # this is just a simple class to load the correct data depending on which sim we are at
179
- class Simulator:
180
- def __init__(self, icarus_df, icarus_agg, verilator_df, verilator_agg):
181
- self.icarus_df = icarus_df
182
- self.icarus_agg = icarus_agg
183
- self.verilator_df = verilator_df
184
- self.verilator_agg = verilator_agg
185
- self.current_simulator = "Icarus"
186
-
187
- def get_current_df(self):
188
- if self.current_simulator == "Icarus":
189
- return self.icarus_df
190
- else:
191
- return self.verilator_df
192
-
193
- def get_current_agg(self):
194
- if self.current_simulator == "Icarus":
195
- return self.icarus_agg
196
- else:
197
- return self.verilator_agg
198
-
199
- def set_simulator(self, simulator):
200
- self.current_simulator = simulator
201
-
202
-
203
  app.launch(
204
  allowed_paths=[
205
  "logo_new.png",
 
6
  from config import constants as C
7
  from handlers.leaderboard_handlers import create_leaderboard_handlers
8
  from results.parse import get_metadata, parse_agg, read_dataframe
9
+ from data_processing import filter_leaderboard, generate_scatter_plot, Simulator
10
  from static.about import CITATION_BUTTON_LABEL, CITATION_BUTTON_TEXT
11
  from static.html_content import (
12
  ABOUT_US_HTML,
 
175
  )
176
 
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  app.launch(
179
  allowed_paths=[
180
  "logo_new.png",
data_processing.py CHANGED
@@ -14,6 +14,32 @@ from config.constants import (
14
  from utils import filter_bench, filter_bench_all, filter_RTLRepo, handle_special_cases
15
 
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  def filter_leaderboard(task, benchmark, model_type, search_query, max_params, state):
18
  """Filter leaderboard data based on user selections."""
19
  subset = state.get_current_df().copy()
 
14
  from utils import filter_bench, filter_bench_all, filter_RTLRepo, handle_special_cases
15
 
16
 
17
+ # this is just a simple class to load the correct data depending on which sim we are at
18
+ class Simulator:
19
+ def __init__(self, icarus_df, icarus_agg, verilator_df, verilator_agg):
20
+ self.icarus_df = icarus_df
21
+ self.icarus_agg = icarus_agg
22
+ self.verilator_df = verilator_df
23
+ self.verilator_agg = verilator_agg
24
+ self.current_simulator = "Icarus"
25
+
26
+ def get_current_df(self):
27
+ if self.current_simulator == "Icarus":
28
+ return self.icarus_df
29
+ else:
30
+ return self.verilator_df
31
+
32
+ def get_current_agg(self):
33
+ if self.current_simulator == "Icarus":
34
+ return self.icarus_agg
35
+ else:
36
+ return self.verilator_agg
37
+
38
+ def set_simulator(self, simulator):
39
+ self.current_simulator = simulator
40
+
41
+
42
+ # filtering main function for the leaderboard body
43
  def filter_leaderboard(task, benchmark, model_type, search_query, max_params, state):
44
  """Filter leaderboard data based on user selections."""
45
  subset = state.get_current_df().copy()