renaming things in submit area
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ from datetime import datetime
|
|
| 12 |
import tempfile
|
| 13 |
from datasets import load_dataset
|
| 14 |
|
| 15 |
-
def make_submission(
|
| 16 |
submitted_file: BinaryIO,
|
| 17 |
user_state):
|
| 18 |
|
|
@@ -36,11 +36,10 @@ def make_submission(problem_type,
|
|
| 36 |
tmp_boundary_path = Path(tmp_boundary.name)
|
| 37 |
|
| 38 |
# write to dataset
|
| 39 |
-
filename = f"{
|
| 40 |
record = {
|
| 41 |
"submission_filename": filename,
|
| 42 |
"submission_time": timestamp,
|
| 43 |
-
"problem_type": problem_type,
|
| 44 |
"csv_content": file_content,
|
| 45 |
"evaluated": False,
|
| 46 |
"user": user_state,
|
|
@@ -55,7 +54,7 @@ def make_submission(problem_type,
|
|
| 55 |
path_in_repo=filename,
|
| 56 |
repo_id=submissions_repo,
|
| 57 |
repo_type="dataset",
|
| 58 |
-
commit_message=f"Add submission for {
|
| 59 |
)
|
| 60 |
Path(tmp_name).unlink()
|
| 61 |
|
|
@@ -117,6 +116,7 @@ with gr.Blocks() as demo:
|
|
| 117 |
gr.Markdown("# Antibody Developability Benchmark Leaderboard")
|
| 118 |
|
| 119 |
get_leaderboard_object()
|
|
|
|
| 120 |
|
| 121 |
# gr.Markdown("Extra info here")
|
| 122 |
|
|
@@ -164,14 +164,13 @@ with gr.Blocks() as demo:
|
|
| 164 |
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column():
|
| 167 |
-
problem_type = gr.Dropdown(ASSAY_LIST, label="Problem Type")
|
| 168 |
username_input = gr.Textbox(
|
| 169 |
label="Username",
|
| 170 |
placeholder="Enter your Hugging Face username",
|
| 171 |
info="This will be displayed on the leaderboard."
|
| 172 |
)
|
| 173 |
with gr.Column():
|
| 174 |
-
boundary_file = gr.File(label="
|
| 175 |
|
| 176 |
username_input.change(
|
| 177 |
fn=lambda x: x if x.strip() else None,
|
|
@@ -186,7 +185,7 @@ with gr.Blocks() as demo:
|
|
| 186 |
|
| 187 |
submit_btn.click(
|
| 188 |
make_submission,
|
| 189 |
-
inputs=[
|
| 190 |
outputs=[message, filename],
|
| 191 |
).then(
|
| 192 |
fn=show_output_box,
|
|
|
|
| 12 |
import tempfile
|
| 13 |
from datasets import load_dataset
|
| 14 |
|
| 15 |
+
def make_submission(
|
| 16 |
submitted_file: BinaryIO,
|
| 17 |
user_state):
|
| 18 |
|
|
|
|
| 36 |
tmp_boundary_path = Path(tmp_boundary.name)
|
| 37 |
|
| 38 |
# write to dataset
|
| 39 |
+
filename = f"{user_state}/{timestamp.replace(':', '-')}_{user_state}.json"
|
| 40 |
record = {
|
| 41 |
"submission_filename": filename,
|
| 42 |
"submission_time": timestamp,
|
|
|
|
| 43 |
"csv_content": file_content,
|
| 44 |
"evaluated": False,
|
| 45 |
"user": user_state,
|
|
|
|
| 54 |
path_in_repo=filename,
|
| 55 |
repo_id=submissions_repo,
|
| 56 |
repo_type="dataset",
|
| 57 |
+
commit_message=f"Add submission for {user_state} at {timestamp}"
|
| 58 |
)
|
| 59 |
Path(tmp_name).unlink()
|
| 60 |
|
|
|
|
| 116 |
gr.Markdown("# Antibody Developability Benchmark Leaderboard")
|
| 117 |
|
| 118 |
get_leaderboard_object()
|
| 119 |
+
# TODO: this is not going to update well, need to fix
|
| 120 |
|
| 121 |
# gr.Markdown("Extra info here")
|
| 122 |
|
|
|
|
| 164 |
|
| 165 |
with gr.Row():
|
| 166 |
with gr.Column():
|
|
|
|
| 167 |
username_input = gr.Textbox(
|
| 168 |
label="Username",
|
| 169 |
placeholder="Enter your Hugging Face username",
|
| 170 |
info="This will be displayed on the leaderboard."
|
| 171 |
)
|
| 172 |
with gr.Column():
|
| 173 |
+
boundary_file = gr.File(label="Submission CSV")
|
| 174 |
|
| 175 |
username_input.change(
|
| 176 |
fn=lambda x: x if x.strip() else None,
|
|
|
|
| 185 |
|
| 186 |
submit_btn.click(
|
| 187 |
make_submission,
|
| 188 |
+
inputs=[boundary_file, user_state],
|
| 189 |
outputs=[message, filename],
|
| 190 |
).then(
|
| 191 |
fn=show_output_box,
|