Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
d00fb74
1 Parent(s): 4a6f9cd

feat: add support to upload anoymously

Browse files
Files changed (2) hide show
  1. app.py +9 -5
  2. utils.py +3 -7
app.py CHANGED
@@ -307,9 +307,14 @@ with demo:
307
  with gr.Column():
308
  model_url = gr.Textbox(label="Model URL")
309
  with gr.Row():
310
- upload_button = gr.UploadButton("Upload search results", file_count="single")
311
  with gr.Row():
312
  file_output = gr.File()
 
 
 
 
 
313
  with gr.Row():
314
  submit_button = gr.Button("Submit")
315
  with gr.Row():
@@ -318,9 +323,6 @@ with demo:
318
  upload_file,
319
  [
320
  upload_button,
321
- model_name,
322
- model_url,
323
- benchmark_version,
324
  ],
325
  file_output)
326
  submit_button.click(
@@ -328,7 +330,9 @@ with demo:
328
  [
329
  file_output,
330
  model_name,
331
- model_url
 
 
332
  ],
333
  submission_result,
334
  show_progress="hidden"
 
307
  with gr.Column():
308
  model_url = gr.Textbox(label="Model URL")
309
  with gr.Row():
310
+ upload_button = gr.UploadButton("Click to upload search results", file_count="single")
311
  with gr.Row():
312
  file_output = gr.File()
313
+ with gr.Row():
314
+ submit_anonymous = gr.Checkbox(
315
+ label="Nope. I want to submit anonymously 🥷",
316
+ value=False,
317
+ info="Do you want to shown on the leaderboard by default?")
318
  with gr.Row():
319
  submit_button = gr.Button("Submit")
320
  with gr.Row():
 
323
  upload_file,
324
  [
325
  upload_button,
 
 
 
326
  ],
327
  file_output)
328
  submit_button.click(
 
330
  [
331
  file_output,
332
  model_name,
333
+ model_url,
334
+ benchmark_version,
335
+ submit_anonymous
336
  ],
337
  submission_result,
338
  show_progress="hidden"
utils.py CHANGED
@@ -141,21 +141,16 @@ def update_metric(
141
  )
142
 
143
 
144
- def upload_file(
145
- filepath: str, model: str, model_url: str, version: str="AIR-Bench_24.04"):
146
- print(f"file uploaded: {filepath}")
147
- # model = "bge-small-en-v1.5"
148
- # version = "AIR-Bench_24.04"
149
  if not filepath.endswith(".zip"):
150
  print(f"file uploading aborted. wrong file type: {filepath}")
151
  return filepath
152
-
153
  return filepath
154
 
155
  from huggingface_hub import ModelCard
156
  from huggingface_hub.utils import EntryNotFoundError
157
 
158
- def submit_results(filepath: str, model: str, model_url: str, version: str="AIR-Bench_24.04"):
159
  if not filepath.endswith(".zip"):
160
  return styled_error(f"file uploading aborted. wrong file type: {filepath}")
161
 
@@ -194,6 +189,7 @@ def submit_results(filepath: str, model: str, model_url: str, version: str="AIR-
194
  "model_name": f"{model}",
195
  "model_url": f"{model_url}",
196
  "version": f"{version}",
 
197
  "revision": f"{revision}",
198
  "timestamp": f"{timestamp}"
199
  }
 
141
  )
142
 
143
 
144
+ def upload_file(filepath: str):
 
 
 
 
145
  if not filepath.endswith(".zip"):
146
  print(f"file uploading aborted. wrong file type: {filepath}")
147
  return filepath
 
148
  return filepath
149
 
150
  from huggingface_hub import ModelCard
151
  from huggingface_hub.utils import EntryNotFoundError
152
 
153
+ def submit_results(filepath: str, model: str, model_url: str, version: str="AIR-Bench_24.04", anonymous=False):
154
  if not filepath.endswith(".zip"):
155
  return styled_error(f"file uploading aborted. wrong file type: {filepath}")
156
 
 
189
  "model_name": f"{model}",
190
  "model_url": f"{model_url}",
191
  "version": f"{version}",
192
+ "anonymous": f"{anonymous}",
193
  "revision": f"{revision}",
194
  "timestamp": f"{timestamp}"
195
  }