bgamazay commited on
Commit
f8f6371
·
verified ·
1 Parent(s): bccdec6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -39,7 +39,7 @@ def make_link(mname):
39
  display_name = parts[1] if len(parts) > 1 else mname
40
  return f'[{display_name}](https://huggingface.co/{mname})'
41
 
42
- # --- Leaderboard Table Functions (Modified to sort BEFORE creating HTML bar) ---
43
 
44
  def create_minimal_bar_html(energy_value_wh, energy_score, max_energy_value):
45
  """Generates HTML for the minimal bar chart with dynamic max energy."""
@@ -74,7 +74,7 @@ def get_model_names(task):
74
  df['Model'] = df['model'].apply(make_link)
75
  df['Score'] = df['energy_score'].apply(format_stars)
76
  df = df[['Model', 'GPU Energy (Wh)', 'Score']] # Keep only these columns
77
- df = df.drop('total_gpu_energy', axis=1) # remove the original energy column that was used for sorting
78
  return df
79
 
80
  def get_all_model_names():
@@ -95,7 +95,8 @@ def get_all_model_names():
95
  all_df['GPU Energy (Wh)'] = all_df.apply(lambda row: create_minimal_bar_html(row['total_gpu_energy'], row['energy_score'], max_energy_overall), axis=1)
96
  all_df['Model'] = all_df['model'].apply(make_link)
97
  all_df['Score'] = all_df['energy_score'].apply(format_stars)
98
- all_df = all_df.drop('total_gpu_energy', axis=1) # remove the original energy column that was used for sorting
 
99
  return all_df[['Model', 'GPU Energy (Wh)', 'Score']]
100
 
101
 
@@ -117,7 +118,7 @@ def get_text_generation_model_names(model_class):
117
  df['Model'] = df['model'].apply(make_link)
118
  df['Score'] = df['energy_score'].apply(format_stars)
119
  df = df[['Model', 'GPU Energy (Wh)', 'Score']] # Keep only these columns
120
- df = df.drop('total_gpu_energy', axis=1) # remove the original energy column that was used for sorting
121
  return df
122
 
123
  def update_text_generation(model_class):
 
39
  display_name = parts[1] if len(parts) > 1 else mname
40
  return f'[{display_name}](https://huggingface.co/{mname})'
41
 
42
+ # --- Leaderboard Table Functions (Removed redundant drop) ---
43
 
44
  def create_minimal_bar_html(energy_value_wh, energy_score, max_energy_value):
45
  """Generates HTML for the minimal bar chart with dynamic max energy."""
 
74
  df['Model'] = df['model'].apply(make_link)
75
  df['Score'] = df['energy_score'].apply(format_stars)
76
  df = df[['Model', 'GPU Energy (Wh)', 'Score']] # Keep only these columns
77
+ # df = df.drop('total_gpu_energy', axis=1) # REMOVED redundant drop
78
  return df
79
 
80
  def get_all_model_names():
 
95
  all_df['GPU Energy (Wh)'] = all_df.apply(lambda row: create_minimal_bar_html(row['total_gpu_energy'], row['energy_score'], max_energy_overall), axis=1)
96
  all_df['Model'] = all_df['model'].apply(make_link)
97
  all_df['Score'] = all_df['energy_score'].apply(format_stars)
98
+ all_df = all_df[['Model', 'GPU Energy (Wh)', 'Score']]
99
+ # all_df = all_df.drop('total_gpu_energy', axis=1) # REMOVED redundant drop
100
  return all_df[['Model', 'GPU Energy (Wh)', 'Score']]
101
 
102
 
 
118
  df['Model'] = df['model'].apply(make_link)
119
  df['Score'] = df['energy_score'].apply(format_stars)
120
  df = df[['Model', 'GPU Energy (Wh)', 'Score']] # Keep only these columns
121
+ # df = df.drop('total_gpu_energy', axis=1) # REMOVED redundant drop
122
  return df
123
 
124
  def update_text_generation(model_class):