bgamazay commited on
Commit
0c2483d
·
verified ·
1 Parent(s): e7cbd6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -126,6 +126,9 @@ def get_leaderboard_models():
126
  data = []
127
  for filename in filenames:
128
  data.append(pd.read_csv(filename))
 
 
 
129
  leaderboard_data = pd.concat(data, ignore_index=True)
130
  return leaderboard_data[['model', 'task']]
131
 
@@ -194,7 +197,7 @@ with gr.Blocks() as demo:
194
  <div style="margin-top: 0px;">
195
  <img src="https://huggingface.co/spaces/AIEnergyScore/Leaderboard/resolve/main/logo.png"
196
  alt="Logo"
197
- style="display: block; margin: 0 auto; max-width: 400px; height: auto;">
198
  </div>
199
  ''')
200
 
@@ -246,4 +249,4 @@ with gr.Blocks() as demo:
246
  with gr.Accordion("Models that have been benchmarked recently:", open=False, visible=False):
247
  gr.Dataframe(formatted_df, elem_classes="full-width")
248
 
249
- demo.launch()
 
126
  data = []
127
  for filename in filenames:
128
  data.append(pd.read_csv(filename))
129
+ # Return an empty dataframe with expected columns if no files are found
130
+ if not data:
131
+ return pd.DataFrame(columns=['model', 'task'])
132
  leaderboard_data = pd.concat(data, ignore_index=True)
133
  return leaderboard_data[['model', 'task']]
134
 
 
197
  <div style="margin-top: 0px;">
198
  <img src="https://huggingface.co/spaces/AIEnergyScore/Leaderboard/resolve/main/logo.png"
199
  alt="Logo"
200
+ style="display: block; margin: 0 auto; max-width: 500px; height: auto;">
201
  </div>
202
  ''')
203
 
 
249
  with gr.Accordion("Models that have been benchmarked recently:", open=False, visible=False):
250
  gr.Dataframe(formatted_df, elem_classes="full-width")
251
 
252
+ demo.launch()