pquintero commited on
Commit
5d5df93
·
1 Parent(s): a7cc355

default to anonymous submissions

Browse files
Files changed (3) hide show
  1. app.py +7 -2
  2. constants.py +2 -0
  3. submit.py +3 -4
app.py CHANGED
@@ -117,9 +117,9 @@ with gr.Blocks() as demo:
117
  with gr.Row():
118
  with gr.Column():
119
  username_input = gr.Textbox(
120
- label="Username",
121
  placeholder="Enter your Hugging Face username",
122
- info="This will be used to track your submissions, and used to add to or update your results if you submit again.",
123
  )
124
  model_name_input = gr.Textbox(
125
  label="Model Name",
@@ -153,6 +153,11 @@ with gr.Blocks() as demo:
153
  )
154
 
155
  def update_submission_type_and_file(submission_type):
 
 
 
 
 
156
  download_file = EXAMPLE_FILE_DICT.get(
157
  submission_type, EXAMPLE_FILE_DICT["GDPa1"]
158
  )
 
117
  with gr.Row():
118
  with gr.Column():
119
  username_input = gr.Textbox(
120
+ label="anonymous_submissions",
121
  placeholder="Enter your Hugging Face username",
122
+ info="This will be used to track your submissions, and to update your results if you submit again. Leave blank for anonymous submissions.",
123
  )
124
  model_name_input = gr.Textbox(
125
  label="Model Name",
 
153
  )
154
 
155
  def update_submission_type_and_file(submission_type):
156
+ """
157
+ Based on the submission type selected in the dropdown,
158
+ Update the submission type state
159
+ Dynamically update example file for download
160
+ """
161
  download_file = EXAMPLE_FILE_DICT.get(
162
  submission_type, EXAMPLE_FILE_DICT["GDPa1"]
163
  )
constants.py CHANGED
@@ -58,3 +58,5 @@ API = HfApi(token=TOKEN)
58
  ORGANIZATION = "ginkgo-datapoints"
59
  SUBMISSIONS_REPO = f"{ORGANIZATION}/abdev-bench-submissions"
60
  RESULTS_REPO = f"{ORGANIZATION}/abdev-bench-results"
 
 
 
58
  ORGANIZATION = "ginkgo-datapoints"
59
  SUBMISSIONS_REPO = f"{ORGANIZATION}/abdev-bench-submissions"
60
  RESULTS_REPO = f"{ORGANIZATION}/abdev-bench-results"
61
+
62
+ ANONYMOUS_SUBMISSION_USERNAME = "anonymous_submissions"
submit.py CHANGED
@@ -7,7 +7,7 @@ import gradio as gr
7
  from datetime import datetime
8
  import uuid
9
 
10
- from constants import API, SUBMISSIONS_REPO
11
  from validation import validate_csv_file, validate_username
12
 
13
 
@@ -18,9 +18,8 @@ def make_submission(
18
  model_name: str = "",
19
  model_description: str = "",
20
  ):
21
- if user_state is None:
22
- raise gr.Error("Please enter your username to submit a file.")
23
-
24
  validate_username(user_state)
25
 
26
  model_name = model_name.strip()
 
7
  from datetime import datetime
8
  import uuid
9
 
10
+ from constants import API, SUBMISSIONS_REPO, ANONYMOUS_SUBMISSION_USERNAME
11
  from validation import validate_csv_file, validate_username
12
 
13
 
 
18
  model_name: str = "",
19
  model_description: str = "",
20
  ):
21
+ # If no username is provided, assume anonymous submission
22
+ user_state = user_state or ANONYMOUS_SUBMISSION_USERNAME
 
23
  validate_username(user_state)
24
 
25
  model_name = model_name.strip()