Spaces:
Running
Running
add email
Browse files
app.py
CHANGED
|
@@ -165,7 +165,7 @@ def update_leaderboard(show_percentage, selected_groups, compact_view, cached_df
|
|
| 165 |
def show_output_box(message):
|
| 166 |
return gr.update(value=message, visible=True)
|
| 167 |
|
| 168 |
-
def submit_cif_files(model_name, problem_type, cif_files, relaxed, profile: gr.OAuthProfile | None):
|
| 169 |
"""Submit structures to the leaderboard."""
|
| 170 |
from huggingface_hub import upload_file
|
| 171 |
|
|
@@ -182,6 +182,9 @@ def submit_cif_files(model_name, problem_type, cif_files, relaxed, profile: gr.O
|
|
| 182 |
if not profile:
|
| 183 |
return "Error: Please log in to submit.", None
|
| 184 |
|
|
|
|
|
|
|
|
|
|
| 185 |
try:
|
| 186 |
username = profile.username
|
| 187 |
timestamp = datetime.now().isoformat()
|
|
@@ -192,6 +195,7 @@ def submit_cif_files(model_name, problem_type, cif_files, relaxed, profile: gr.O
|
|
| 192 |
"model_name": model_name.strip(),
|
| 193 |
"problem_type": problem_type,
|
| 194 |
"relaxed": relaxed,
|
|
|
|
| 195 |
"timestamp": timestamp,
|
| 196 |
"file_name": Path(cif_files).name
|
| 197 |
}
|
|
@@ -399,6 +403,11 @@ Verified submissions mean the results came from a model submission rather than a
|
|
| 399 |
placeholder="Enter your model name",
|
| 400 |
info="Provide a name for your model/method"
|
| 401 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
problem_type = gr.Dropdown(PROBLEM_TYPES, label="Problem Type")
|
| 403 |
with gr.Column():
|
| 404 |
cif_file = gr.File(label="Upload a CSV, a pkl, or a ZIP of CIF files.")
|
|
@@ -415,7 +424,7 @@ Verified submissions mean the results came from a model submission rather than a
|
|
| 415 |
|
| 416 |
submit_btn.click(
|
| 417 |
submit_cif_files,
|
| 418 |
-
inputs=[model_name_input, problem_type, cif_file, relaxed],
|
| 419 |
outputs=[message, filename],
|
| 420 |
).then(
|
| 421 |
fn=show_output_box,
|
|
|
|
| 165 |
def show_output_box(message):
|
| 166 |
return gr.update(value=message, visible=True)
|
| 167 |
|
| 168 |
+
def submit_cif_files(model_name, problem_type, cif_files, relaxed, email, profile: gr.OAuthProfile | None):
|
| 169 |
"""Submit structures to the leaderboard."""
|
| 170 |
from huggingface_hub import upload_file
|
| 171 |
|
|
|
|
| 182 |
if not profile:
|
| 183 |
return "Error: Please log in to submit.", None
|
| 184 |
|
| 185 |
+
if not email or not email.strip():
|
| 186 |
+
return "Error: Please provide an email address.", None
|
| 187 |
+
|
| 188 |
try:
|
| 189 |
username = profile.username
|
| 190 |
timestamp = datetime.now().isoformat()
|
|
|
|
| 195 |
"model_name": model_name.strip(),
|
| 196 |
"problem_type": problem_type,
|
| 197 |
"relaxed": relaxed,
|
| 198 |
+
"email": email.strip(),
|
| 199 |
"timestamp": timestamp,
|
| 200 |
"file_name": Path(cif_files).name
|
| 201 |
}
|
|
|
|
| 403 |
placeholder="Enter your model name",
|
| 404 |
info="Provide a name for your model/method"
|
| 405 |
)
|
| 406 |
+
email_input = gr.Textbox(
|
| 407 |
+
label="Email Address",
|
| 408 |
+
placeholder="Enter your email address",
|
| 409 |
+
info="Contact email for correspondence about this submission"
|
| 410 |
+
)
|
| 411 |
problem_type = gr.Dropdown(PROBLEM_TYPES, label="Problem Type")
|
| 412 |
with gr.Column():
|
| 413 |
cif_file = gr.File(label="Upload a CSV, a pkl, or a ZIP of CIF files.")
|
|
|
|
| 424 |
|
| 425 |
submit_btn.click(
|
| 426 |
submit_cif_files,
|
| 427 |
+
inputs=[model_name_input, problem_type, cif_file, relaxed, email_input],
|
| 428 |
outputs=[message, filename],
|
| 429 |
).then(
|
| 430 |
fn=show_output_box,
|