sasha HF Staff commited on
Commit
5978d25
·
verified ·
1 Parent(s): 4df1b55

Update app.py

Browse files

trying to style

Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -110,11 +110,28 @@ def add_new_eval(
110
  gr.Info("Starting compute space at %s " % COMPUTE_SPACE)
111
  return start_compute_space()
112
 
 
 
 
 
 
 
113
  def print_existing_models():
114
  requests= load_dataset("EnergyStarAI/requests_debug", split="test", token=TOKEN)
115
  requests_dset = requests.to_pandas()
116
- model_list= requests_dset[requests_dset['status'] == 'COMPLETED']
117
- return model_list[['model','task']]
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  def get_leaderboard_models():
120
  path = r'leaderboard_v0_data/energy'
@@ -168,5 +185,5 @@ with gr.Blocks() as demo:
168
  with gr.Accordion("Models that are in the latest leaderboard version:", open = False):
169
  gr.Dataframe(get_leaderboard_models())
170
  with gr.Accordion("Models that have been benchmarked recently:", open = False):
171
- gr.Dataframe(print_existing_models())
172
  demo.launch()
 
110
  gr.Info("Starting compute space at %s " % COMPUTE_SPACE)
111
  return start_compute_space()
112
 
113
+ def color_cols(x):
114
+ df = x.copy()
115
+ df.loc[:, :] = 'color: purple'
116
+ df[['B', 'C', 'E']] = 'color: green'
117
+ return df
118
+
119
  def print_existing_models():
120
  requests= load_dataset("EnergyStarAI/requests_debug", split="test", token=TOKEN)
121
  requests_dset = requests.to_pandas()
122
+ model_df= requests_dset[['model','task']]
123
+ return model_df
124
+
125
+ def highlight_cols(x):
126
+ df = x.copy()
127
+ df[df['status'] == 'COMPLETED'] = 'color: green'
128
+ df[df['status'] == 'PENDING'] = 'color: orange'
129
+ df[df['status'] == 'FAILED'] = 'color: red'
130
+ return df
131
+
132
+ # Applying the style function
133
+ existing_models = print_existing_models()
134
+ formatted_df = existing_models.style.apply(highlight_cols, axis = None)
135
 
136
  def get_leaderboard_models():
137
  path = r'leaderboard_v0_data/energy'
 
185
  with gr.Accordion("Models that are in the latest leaderboard version:", open = False):
186
  gr.Dataframe(get_leaderboard_models())
187
  with gr.Accordion("Models that have been benchmarked recently:", open = False):
188
+ gr.Dataframe(formatted_df)
189
  demo.launch()