Scott Cogan
commited on
Commit
·
9fd6e24
1
Parent(s):
263eda6
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,27 +366,20 @@ with gr.Blocks() as demo:
|
|
| 366 |
"""
|
| 367 |
)
|
| 368 |
|
| 369 |
-
|
| 370 |
-
|
| 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
|
| 377 |
-
if
|
| 378 |
-
return
|
| 379 |
-
return
|
| 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=
|
| 389 |
-
inputs=[
|
| 390 |
outputs=[status_output, results_table]
|
| 391 |
)
|
| 392 |
|
|
|
|
| 229 |
return messages["messages"][-1].content if messages["messages"] else fixed_answer
|
| 230 |
|
| 231 |
|
| 232 |
+
def run_and_submit_all( profile: gr.OAuthProfile | None, username: str):
|
| 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. Enter your Hugging Face username below.
|
| 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 |
+
username = gr.Textbox(label="Hugging Face Username", placeholder="Enter your Hugging Face username")
|
| 370 |
+
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
|
|
|
| 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 run_evaluation(username):
|
| 376 |
+
if not username:
|
| 377 |
+
return "Please enter your Hugging Face username.", None
|
| 378 |
+
return run_and_submit_all(None, username)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 379 |
|
| 380 |
run_button.click(
|
| 381 |
+
fn=run_evaluation,
|
| 382 |
+
inputs=[username],
|
| 383 |
outputs=[status_output, results_table]
|
| 384 |
)
|
| 385 |
|