Clémentine commited on
Commit
676e2ea
·
1 Parent(s): 39d3076

added rate limit

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -80,6 +80,12 @@ def add_new_eval(
80
  mail: str,
81
  profile: gr.OAuthProfile,
82
  ):
 
 
 
 
 
 
83
  is_validation = val_or_test == "validation"
84
  # Very basic email parsing
85
  _, parsed_mail = parseaddr(mail)
@@ -193,8 +199,10 @@ def add_new_eval(
193
  "model": model,
194
  "model_family": model_family,
195
  "url": url,
196
- "organisation": f"{organisation} | user {profile.username}",
 
197
  "mail": mail,
 
198
  }
199
  contact_infos[val_or_test]= contact_infos[val_or_test].add_item(contact_info)
200
  contact_infos.push_to_hub(CONTACT_DATASET, config_name = YEAR_VERSION, token=TOKEN)
 
80
  mail: str,
81
  profile: gr.OAuthProfile,
82
  ):
83
+ contact_infos = load_dataset(CONTACT_DATASET, YEAR_VERSION, token=TOKEN, download_mode="force_redownload", verification_mode=VerificationMode.NO_CHECKS, trust_remote_code=True)
84
+ user_submission_dates = sorted(row["date"] for row in contact_info[val_or_test] if row["username"] == profile.username)
85
+ if user_submission_dates[-1] == datetime.datetime.today().strftime('%Y-%m-%d'):
86
+ return format_error("You already submitted once today, please try again tomorrow.")
87
+
88
+
89
  is_validation = val_or_test == "validation"
90
  # Very basic email parsing
91
  _, parsed_mail = parseaddr(mail)
 
199
  "model": model,
200
  "model_family": model_family,
201
  "url": url,
202
+ "organisation": organisation,
203
+ "username": profile.username,
204
  "mail": mail,
205
+ "date": datetime.datetime.today().strftime('%Y-%m-%d')
206
  }
207
  contact_infos[val_or_test]= contact_infos[val_or_test].add_item(contact_info)
208
  contact_infos.push_to_hub(CONTACT_DATASET, config_name = YEAR_VERSION, token=TOKEN)