Shiyu Zhao
commited on
Commit
·
1250c3d
1
Parent(s):
55db40e
Update space
Browse files
app.py
CHANGED
@@ -114,7 +114,11 @@ def process_submission(
|
|
114 |
code_repo, csv_file, model_description, hardware, paper_link
|
115 |
):
|
116 |
"""Process and validate submission"""
|
117 |
-
#
|
|
|
|
|
|
|
|
|
118 |
if len(method_name) > 25:
|
119 |
return "Error: Method name must be 25 characters or less"
|
120 |
if len(team_name) > 25:
|
@@ -175,70 +179,74 @@ def process_submission(
|
|
175 |
except Exception as e:
|
176 |
return f"Error processing submission: {str(e)}"
|
177 |
|
178 |
-
# Add this to your existing Gradio interface
|
179 |
def add_submission_form(demo):
|
180 |
with demo:
|
|
|
181 |
gr.Markdown("## Submit Your Results")
|
182 |
gr.Markdown("""
|
183 |
Submit your results to be included in the leaderboard. Please ensure your submission meets all requirements.
|
184 |
For questions, contact stark-qa@cs.stanford.edu
|
185 |
""")
|
186 |
|
187 |
-
with gr.
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
placeholder="https://github.com/username/repository"
|
212 |
-
)
|
213 |
-
csv_file = gr.File(
|
214 |
-
label="Prediction CSV",
|
215 |
-
file_types=[".csv"]
|
216 |
-
)
|
217 |
-
model_description = gr.Textbox(
|
218 |
-
label="Model Description",
|
219 |
-
lines=3,
|
220 |
-
placeholder="Briefly describe how your retriever model works..."
|
221 |
-
)
|
222 |
-
hardware = gr.Textbox(
|
223 |
-
label="Hardware Specifications",
|
224 |
-
placeholder="e.g., 4x NVIDIA A100 80GB"
|
225 |
-
)
|
226 |
-
paper_link = gr.Textbox(
|
227 |
-
label="Paper Link (Optional)",
|
228 |
-
placeholder="https://arxiv.org/abs/..."
|
229 |
-
)
|
230 |
-
|
231 |
-
submit_btn = gr.Button("Submit", variant="primary")
|
232 |
-
result = gr.Textbox(label="Submission Status", interactive=False)
|
233 |
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
def format_dataframe(df, dataset):
|
244 |
# Filter the dataframe for the selected dataset
|
|
|
114 |
code_repo, csv_file, model_description, hardware, paper_link
|
115 |
):
|
116 |
"""Process and validate submission"""
|
117 |
+
# Input validation
|
118 |
+
if not method_name or not team_name or not dataset or not split or not contact_email or not code_repo or not csv_file:
|
119 |
+
return "Error: Please fill in all required fields"
|
120 |
+
|
121 |
+
# Length validation
|
122 |
if len(method_name) > 25:
|
123 |
return "Error: Method name must be 25 characters or less"
|
124 |
if len(team_name) > 25:
|
|
|
179 |
except Exception as e:
|
180 |
return f"Error processing submission: {str(e)}"
|
181 |
|
|
|
182 |
def add_submission_form(demo):
|
183 |
with demo:
|
184 |
+
gr.Markdown("---")
|
185 |
gr.Markdown("## Submit Your Results")
|
186 |
gr.Markdown("""
|
187 |
Submit your results to be included in the leaderboard. Please ensure your submission meets all requirements.
|
188 |
For questions, contact stark-qa@cs.stanford.edu
|
189 |
""")
|
190 |
|
191 |
+
with gr.Row():
|
192 |
+
with gr.Column():
|
193 |
+
method_name = gr.Textbox(
|
194 |
+
label="Method Name (max 25 chars)*",
|
195 |
+
placeholder="e.g., MyRetrievalModel-v1"
|
196 |
+
)
|
197 |
+
team_name = gr.Textbox(
|
198 |
+
label="Team Name (max 25 chars)*",
|
199 |
+
placeholder="e.g., Stanford NLP"
|
200 |
+
)
|
201 |
+
dataset = gr.Dropdown(
|
202 |
+
choices=["amazon", "mag", "prime"],
|
203 |
+
label="Dataset*",
|
204 |
+
value="amazon"
|
205 |
+
)
|
206 |
+
split = gr.Dropdown(
|
207 |
+
choices=["test", "test-0.1", "human_generated_eval"],
|
208 |
+
label="Split*",
|
209 |
+
value="test"
|
210 |
+
)
|
211 |
+
contact_email = gr.Textbox(
|
212 |
+
label="Contact Email(s)*",
|
213 |
+
placeholder="email@example.com; another@example.com"
|
214 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
+
with gr.Column():
|
217 |
+
code_repo = gr.Textbox(
|
218 |
+
label="Code Repository*",
|
219 |
+
placeholder="https://github.com/username/repository"
|
220 |
+
)
|
221 |
+
csv_file = gr.File(
|
222 |
+
label="Prediction CSV*",
|
223 |
+
file_types=[".csv"]
|
224 |
+
)
|
225 |
+
model_description = gr.Textbox(
|
226 |
+
label="Model Description*",
|
227 |
+
lines=3,
|
228 |
+
placeholder="Briefly describe how your retriever model works..."
|
229 |
+
)
|
230 |
+
hardware = gr.Textbox(
|
231 |
+
label="Hardware Specifications*",
|
232 |
+
placeholder="e.g., 4x NVIDIA A100 80GB"
|
233 |
+
)
|
234 |
+
paper_link = gr.Textbox(
|
235 |
+
label="Paper Link (Optional)",
|
236 |
+
placeholder="https://arxiv.org/abs/..."
|
237 |
+
)
|
238 |
+
|
239 |
+
submit_btn = gr.Button("Submit", variant="primary")
|
240 |
+
result = gr.Textbox(label="Submission Status", interactive=False)
|
241 |
+
|
242 |
+
submit_btn.click(
|
243 |
+
process_submission,
|
244 |
+
inputs=[
|
245 |
+
method_name, team_name, dataset, split, contact_email,
|
246 |
+
code_repo, csv_file, model_description, hardware, paper_link
|
247 |
+
],
|
248 |
+
outputs=result
|
249 |
+
)
|
250 |
|
251 |
def format_dataframe(df, dataset):
|
252 |
# Filter the dataframe for the selected dataset
|