tidy up default to anon submission
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ from constants import (
|
|
| 10 |
ASSAY_EMOJIS,
|
| 11 |
ASSAY_DESCRIPTION,
|
| 12 |
EXAMPLE_FILE_DICT,
|
|
|
|
| 13 |
)
|
| 14 |
from about import ABOUT_TEXT, FAQS
|
| 15 |
from submit import make_submission
|
|
@@ -110,10 +111,6 @@ with gr.Blocks() as demo:
|
|
| 110 |
submission_type_state = gr.State(value="GDPa1")
|
| 111 |
download_file_state = gr.State(value=EXAMPLE_FILE_DICT["GDPa1"])
|
| 112 |
|
| 113 |
-
login_button = gr.LoginButton(
|
| 114 |
-
value="Sign in with Hugging Face to see account name"
|
| 115 |
-
) # Note(Lood): Is this mandatory?
|
| 116 |
-
|
| 117 |
with gr.Row():
|
| 118 |
with gr.Column():
|
| 119 |
username_input = gr.Textbox(
|
|
@@ -145,9 +142,9 @@ with gr.Blocks() as demo:
|
|
| 145 |
)
|
| 146 |
submission_file = gr.File(label="Submission CSV")
|
| 147 |
|
| 148 |
-
#
|
| 149 |
username_input.change(
|
| 150 |
-
fn=lambda x: x if x.strip() else
|
| 151 |
inputs=username_input,
|
| 152 |
outputs=user_state,
|
| 153 |
)
|
|
|
|
| 10 |
ASSAY_EMOJIS,
|
| 11 |
ASSAY_DESCRIPTION,
|
| 12 |
EXAMPLE_FILE_DICT,
|
| 13 |
+
ANONYMOUS_SUBMISSION_USERNAME,
|
| 14 |
)
|
| 15 |
from about import ABOUT_TEXT, FAQS
|
| 16 |
from submit import make_submission
|
|
|
|
| 111 |
submission_type_state = gr.State(value="GDPa1")
|
| 112 |
download_file_state = gr.State(value=EXAMPLE_FILE_DICT["GDPa1"])
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
with gr.Row():
|
| 115 |
with gr.Column():
|
| 116 |
username_input = gr.Textbox(
|
|
|
|
| 142 |
)
|
| 143 |
submission_file = gr.File(label="Submission CSV")
|
| 144 |
|
| 145 |
+
# If username is empty, set to anonymous submission
|
| 146 |
username_input.change(
|
| 147 |
+
fn=lambda x: x if x.strip() else ANONYMOUS_SUBMISSION_USERNAME,
|
| 148 |
inputs=username_input,
|
| 149 |
outputs=user_state,
|
| 150 |
)
|
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,8 +18,6 @@ def make_submission(
|
|
| 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()
|
|
|
|
| 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 |
model_name: str = "",
|
| 19 |
model_description: str = "",
|
| 20 |
):
|
|
|
|
|
|
|
| 21 |
validate_username(user_state)
|
| 22 |
|
| 23 |
model_name = model_name.strip()
|