ggcristian commited on
Commit
becd2f0
·
1 Parent(s): f73e511

RTL-Repo bug

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -15,7 +15,7 @@ from gradio.themes.utils import colors
15
  def filter_leaderboard(task, benchmark, model_type, search_query, max_params):
16
  subset = df.copy()
17
 
18
- # Filter by task-specific benchmarks when 'All' benchmarks is selected
19
  if task == "Spec-to-RTL":
20
  valid_benchmarks = s2r_benchs
21
  if benchmark == 'All':
@@ -29,13 +29,11 @@ def filter_leaderboard(task, benchmark, model_type, search_query, max_params):
29
  if benchmark == 'All':
30
  subset = subset[subset['Benchmark'].isin(valid_benchmarks)]
31
 
32
- # Apply benchmark filter if not "All"
33
  if benchmark != 'All':
34
  subset = df[df['Benchmark'] == benchmark]
35
 
36
- # Apply other filters
37
  if model_type != 'All':
38
- # For dropdown without emojis
39
  subset = subset[subset['Model Type'] == model_type]
40
  if search_query:
41
  subset = subset[subset['Model'].str.contains(search_query, case=False, na=False)]
@@ -52,7 +50,6 @@ def filter_leaderboard(task, benchmark, model_type, search_query, max_params):
52
  elif benchmark == 'RTL-Repo':
53
  return filter_RTLRepo(subset)
54
  else:
55
- # Pass the specific benchmark aggregate column
56
  agg_column = None
57
  if benchmark == 'VerilogEval S2R':
58
  agg_column = 'Agg VerilogEval S2R'
@@ -71,7 +68,7 @@ def update_benchmarks_by_task(task):
71
  elif task == "Code Completion":
72
  return gr.update(choices=["All"] + cc_benchs, value="All")
73
  elif task == "Line Completion":
74
- return gr.update(choices=lc_benchs, value="RTL-Repo")
75
  else:
76
  return gr.update(choices=["All"] + benchmarks, value="All")
77
 
@@ -273,8 +270,8 @@ with gr.Blocks(css=custom_css, js=js_func, theme=gr.themes.Default(primary_hue=c
273
  """
274
  <div style="max-width: 800px; margin: auto; padding: 20px; border: 1px solid #ccc; border-radius: 10px;">
275
  <div style="display: flex; justify-content: center; align-items: center; gap: 5%; margin-bottom: 20px;">
276
- <img src='https://hpai.bsc.es/images/hpai_logo_grad.png' alt='HPAI Group Logo' style="width: 45%;"/>
277
- <img src='https://hpai.bsc.es/images/bsc-logo.png' alt='BSC Logo' style="width: 25%;"/>
278
  </div>
279
 
280
  <p style="font-size: 16px; text-align: start;">
@@ -309,12 +306,8 @@ with gr.Blocks(css=custom_css, js=js_func, theme=gr.themes.Default(primary_hue=c
309
  )
310
 
311
  # event handlers, ugly way but it works
312
- task_radio.change(
313
- fn=update_benchmarks_by_task,
314
- inputs=[task_radio],
315
- outputs=[benchmark_radio]
316
- )
317
- task_radio.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
318
  benchmark_radio.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
319
  model_type_dropdown.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
320
  search_box.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
 
15
  def filter_leaderboard(task, benchmark, model_type, search_query, max_params):
16
  subset = df.copy()
17
 
18
+ # Filter by task specific benchmarks when 'All' benchmarks is selected
19
  if task == "Spec-to-RTL":
20
  valid_benchmarks = s2r_benchs
21
  if benchmark == 'All':
 
29
  if benchmark == 'All':
30
  subset = subset[subset['Benchmark'].isin(valid_benchmarks)]
31
 
 
32
  if benchmark != 'All':
33
  subset = df[df['Benchmark'] == benchmark]
34
 
 
35
  if model_type != 'All':
36
+ # without emojis
37
  subset = subset[subset['Model Type'] == model_type]
38
  if search_query:
39
  subset = subset[subset['Model'].str.contains(search_query, case=False, na=False)]
 
50
  elif benchmark == 'RTL-Repo':
51
  return filter_RTLRepo(subset)
52
  else:
 
53
  agg_column = None
54
  if benchmark == 'VerilogEval S2R':
55
  agg_column = 'Agg VerilogEval S2R'
 
68
  elif task == "Code Completion":
69
  return gr.update(choices=["All"] + cc_benchs, value="All")
70
  elif task == "Line Completion":
71
+ return gr.update(choices=["All"] + lc_benchs, value="All")
72
  else:
73
  return gr.update(choices=["All"] + benchmarks, value="All")
74
 
 
270
  """
271
  <div style="max-width: 800px; margin: auto; padding: 20px; border: 1px solid #ccc; border-radius: 10px;">
272
  <div style="display: flex; justify-content: center; align-items: center; gap: 5%; margin-bottom: 20px;">
273
+ <img src='/gradio_api/file=hpai_logo_grad.png' alt='HPAI Group Logo' style="width: 45%;"/>
274
+ <img src='/gradio_api/file=bsc-logo.png' alt='BSC Logo' style="width: 25%;"/>
275
  </div>
276
 
277
  <p style="font-size: 16px; text-align: start;">
 
306
  )
307
 
308
  # event handlers, ugly way but it works
309
+ task_radio.change(fn=update_benchmarks_by_task, inputs=[task_radio], outputs=[benchmark_radio])
310
+ # task_radio.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
 
 
 
 
311
  benchmark_radio.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
312
  model_type_dropdown.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)
313
  search_box.change(fn=filter_leaderboard, inputs=[task_radio, benchmark_radio, model_type_dropdown, search_box, params_slider], outputs=leaderboard)