Scott Cogan
commited on
Commit
·
4b5824e
1
Parent(s):
9fd6e24
gradio
Browse files
app.py
CHANGED
|
@@ -229,7 +229,7 @@ class BasicAgent:
|
|
| 229 |
return messages["messages"][-1].content if messages["messages"] else fixed_answer
|
| 230 |
|
| 231 |
|
| 232 |
-
def run_and_submit_all( profile: gr.OAuthProfile | None
|
| 233 |
"""
|
| 234 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 235 |
and displays the results.
|
|
@@ -357,7 +357,7 @@ with gr.Blocks() as demo:
|
|
| 357 |
"""
|
| 358 |
**Instructions:**
|
| 359 |
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 360 |
-
2.
|
| 361 |
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
| 362 |
---
|
| 363 |
**Disclaimers:**
|
|
@@ -366,20 +366,27 @@ with gr.Blocks() as demo:
|
|
| 366 |
"""
|
| 367 |
)
|
| 368 |
|
| 369 |
-
|
| 370 |
-
|
|
|
|
| 371 |
|
| 372 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 373 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 374 |
|
| 375 |
-
def
|
| 376 |
-
if
|
| 377 |
-
return
|
| 378 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
run_button.click(
|
| 381 |
-
fn=
|
| 382 |
-
inputs=[
|
| 383 |
outputs=[status_output, results_table]
|
| 384 |
)
|
| 385 |
|
|
|
|
| 229 |
return messages["messages"][-1].content if messages["messages"] else fixed_answer
|
| 230 |
|
| 231 |
|
| 232 |
+
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 233 |
"""
|
| 234 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 235 |
and displays the results.
|
|
|
|
| 357 |
"""
|
| 358 |
**Instructions:**
|
| 359 |
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 360 |
+
2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
|
| 361 |
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
| 362 |
---
|
| 363 |
**Disclaimers:**
|
|
|
|
| 366 |
"""
|
| 367 |
)
|
| 368 |
|
| 369 |
+
with gr.Row():
|
| 370 |
+
login_button = gr.LoginButton()
|
| 371 |
+
run_button = gr.Button("Run Evaluation & Submit All Answers", interactive=False)
|
| 372 |
|
| 373 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 374 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 375 |
|
| 376 |
+
def enable_run_button(profile):
|
| 377 |
+
if profile:
|
| 378 |
+
return gr.Button.update(interactive=True)
|
| 379 |
+
return gr.Button.update(interactive=False)
|
| 380 |
+
|
| 381 |
+
login_button.click(
|
| 382 |
+
fn=enable_run_button,
|
| 383 |
+
inputs=[login_button],
|
| 384 |
+
outputs=[run_button]
|
| 385 |
+
)
|
| 386 |
|
| 387 |
run_button.click(
|
| 388 |
+
fn=run_and_submit_all,
|
| 389 |
+
inputs=[login_button],
|
| 390 |
outputs=[status_output, results_table]
|
| 391 |
)
|
| 392 |
|