Blanca commited on
Commit
85e51be
·
verified ·
1 Parent(s): 6a05c32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -152,7 +152,7 @@ def add_new_eval(
152
  # Was the profile created less than 2 month ago?
153
  user_data = requests.get(f"https://huggingface.co/api/users/{profile.username}/overview")
154
  creation_date = json.loads(user_data.content)["createdAt"]
155
- if datetime.datetime.now() - datetime.datetime.strptime(creation_date, '%Y-%m-%d') < datetime.timedelta(days=60):
156
  return format_error("This account is not authorized to submit on this leaderboard.")
157
 
158
  # TODO: I should reactivate this check
@@ -368,7 +368,7 @@ with demo:
368
  value=CITATION_BUTTON_TEXT,
369
  label=CITATION_BUTTON_LABEL,
370
  elem_id="citation-button",
371
- lines=5,
372
  max_lines=10,
373
  show_copy_button=True,
374
  )
@@ -402,18 +402,22 @@ with demo:
402
  gr.LoginButton()
403
  submit_button = gr.Button("Submit Eval")
404
  submission_result = gr.Markdown()
405
- submit_button.click(
406
- add_new_eval,
407
- [
408
- model_name_textbox,
409
- model_family_textbox,
410
- system_prompt_textbox,
411
- url_textbox,
412
- file_output,
413
- organisation,
414
- mail
415
- ],
416
- submission_result,
 
 
 
 
417
  )
418
 
419
 
 
152
  # Was the profile created less than 2 month ago?
153
  user_data = requests.get(f"https://huggingface.co/api/users/{profile.username}/overview")
154
  creation_date = json.loads(user_data.content)["createdAt"]
155
+ if datetime.datetime.now() - datetime.datetime.strptime(creation_date, '%Y-%m-%dT%H:%M:%S.%fZ') < datetime.timedelta(days=60):
156
  return format_error("This account is not authorized to submit on this leaderboard.")
157
 
158
  # TODO: I should reactivate this check
 
368
  value=CITATION_BUTTON_TEXT,
369
  label=CITATION_BUTTON_LABEL,
370
  elem_id="citation-button",
371
+ lines=10,
372
  max_lines=10,
373
  show_copy_button=True,
374
  )
 
402
  gr.LoginButton()
403
  submit_button = gr.Button("Submit Eval")
404
  submission_result = gr.Markdown()
405
+ submit_button.submit.click(
406
+ fn=lambda: "⏳ Submitting...",
407
+ inputs=None,
408
+ outputs=status,
409
+ ).then(
410
+ add_new_eval,
411
+ [
412
+ model_name_textbox,
413
+ model_family_textbox,
414
+ system_prompt_textbox,
415
+ url_textbox,
416
+ file_output,
417
+ organisation,
418
+ mail
419
+ ],
420
+ submission_result,
421
  )
422
 
423