Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -440,30 +440,48 @@ def run_and_submit_all_evaluation(profile: Optional[gr.OAuthProfile]) -> Tuple[s
|
|
| 440 |
|
| 441 |
# --- Build Gradio Interface ---
|
| 442 |
with gr.Blocks() as demo:
|
| 443 |
-
gr.Markdown("#
|
| 444 |
-
|
| 445 |
-
|
|
|
|
| 446 |
**Instructions:**
|
| 447 |
-
1.
|
| 448 |
-
2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 449 |
---
|
| 450 |
-
**
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
Consider trying `OPENAI_MODEL_ID = "gpt-3.5-turbo"` in the script for faster evaluation.
|
| 456 |
"""
|
| 457 |
)
|
| 458 |
|
| 459 |
-
login_button = gr.LoginButton()
|
| 460 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 461 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=10, interactive=False)
|
|
|
|
|
|
|
| 462 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True, max_rows=20)
|
| 463 |
|
| 464 |
run_button.click(
|
| 465 |
fn=run_and_submit_all_evaluation,
|
| 466 |
-
inputs=[login_button],
|
| 467 |
outputs=[status_output, results_table]
|
| 468 |
)
|
| 469 |
|
|
|
|
| 440 |
|
| 441 |
# --- Build Gradio Interface ---
|
| 442 |
with gr.Blocks() as demo:
|
| 443 |
+
gr.Markdown("# Basic Agent Evaluation Runner") # MODIFIED TITLE to match screenshot
|
| 444 |
+
|
| 445 |
+
gr.Markdown( # INSTRUCTIONS BLOCK
|
| 446 |
+
"""
|
| 447 |
**Instructions:**
|
| 448 |
+
1. Please clone this space, then modify the code to define your agent's logic, the tools, the necessary packages, etc ...
|
| 449 |
+
2. Log in to your Hugging Face account using the button below. This uses your HF username for submission.
|
| 450 |
+
3. Click 'Run Evaluation & Submit All Answers' to fetch questions, run your agent, submit answers, and see the score.
|
| 451 |
+
"""
|
| 452 |
+
)
|
| 453 |
+
|
| 454 |
+
gr.Markdown( # ADDED DISCLAIMER BLOCK
|
| 455 |
+
"""
|
| 456 |
+
**Disclaimers:** Once clicking on the "submit" button, it can take quite some time ( this is the time for the agent to go through all the questions). This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a separate action or even to answer the questions in async.
|
| 457 |
+
"""
|
| 458 |
+
)
|
| 459 |
+
# NOTE: The original script's "Note:" section about API keys is important and was part of its instructions.
|
| 460 |
+
# You might want to integrate it back into the instructions or as a separate note if it's not covered by the screenshot's intent.
|
| 461 |
+
# For now, I'm prioritizing matching the screenshot's distinct "Instructions" and "Disclaimers".
|
| 462 |
+
# Let's add the technical notes below the disclaimers or combine logically.
|
| 463 |
+
|
| 464 |
+
gr.Markdown(
|
| 465 |
+
f"""
|
| 466 |
---
|
| 467 |
+
**Technical Notes:**
|
| 468 |
+
* The agent uses `smolagents`, OpenAI (model: `{CONFIG.OPENAI_MODEL_ID}`), and Serper API for searches.
|
| 469 |
+
* Ensure `OPENAI_API_KEY` and `SERPER_API_KEY` are set as Space Secrets.
|
| 470 |
+
* `requirements.txt` should specify `gradio>=4.19.2` or newer.
|
| 471 |
+
* Consider trying `OPENAI_MODEL_ID = "gpt-3.5-turbo"` in the script for faster evaluation if it's currently set to `gpt-4`.
|
|
|
|
| 472 |
"""
|
| 473 |
)
|
| 474 |
|
| 475 |
+
login_button = gr.LoginButton() # "Sign In with Hugging Face"
|
| 476 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 477 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=10, interactive=False)
|
| 478 |
+
# The DataFrame will initially be empty. When populated, its headers will be:
|
| 479 |
+
# "Task ID", "Question", "Submitted Answer", "Reasoning Trace"
|
| 480 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True, max_rows=20)
|
| 481 |
|
| 482 |
run_button.click(
|
| 483 |
fn=run_and_submit_all_evaluation,
|
| 484 |
+
inputs=[login_button],
|
| 485 |
outputs=[status_output, results_table]
|
| 486 |
)
|
| 487 |
|