Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,7 @@ class BasicAgent:
|
|
| 33 |
return answer[14:]
|
| 34 |
|
| 35 |
|
| 36 |
-
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 37 |
"""
|
| 38 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 39 |
and displays the results.
|
|
@@ -87,6 +87,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 87 |
results_log = []
|
| 88 |
answers_payload = []
|
| 89 |
print(f"Running agent on {len(questions_data)} questions...")
|
|
|
|
|
|
|
|
|
|
| 90 |
for item in questions_data:
|
| 91 |
task_id = item.get("task_id")
|
| 92 |
question_text = item.get("question")
|
|
@@ -176,12 +179,15 @@ with gr.Blocks() as demo:
|
|
| 176 |
|
| 177 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 178 |
|
|
|
|
|
|
|
| 179 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 180 |
# Removed max_rows=10 from DataFrame constructor
|
| 181 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 182 |
|
| 183 |
run_button.click(
|
| 184 |
fn=run_and_submit_all,
|
|
|
|
| 185 |
outputs=[status_output, results_table]
|
| 186 |
)
|
| 187 |
|
|
|
|
| 33 |
return answer[14:]
|
| 34 |
|
| 35 |
|
| 36 |
+
def run_and_submit_all(nb_questions: int, profile: gr.OAuthProfile | None):
|
| 37 |
"""
|
| 38 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 39 |
and displays the results.
|
|
|
|
| 87 |
results_log = []
|
| 88 |
answers_payload = []
|
| 89 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 90 |
+
|
| 91 |
+
questions_data = questions_data[:nb_questions]
|
| 92 |
+
|
| 93 |
for item in questions_data:
|
| 94 |
task_id = item.get("task_id")
|
| 95 |
question_text = item.get("question")
|
|
|
|
| 179 |
|
| 180 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 181 |
|
| 182 |
+
nb_questions = gr.Number(value=3)
|
| 183 |
+
|
| 184 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
| 185 |
# Removed max_rows=10 from DataFrame constructor
|
| 186 |
results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
|
| 187 |
|
| 188 |
run_button.click(
|
| 189 |
fn=run_and_submit_all,
|
| 190 |
+
inputs=[nb_questions],
|
| 191 |
outputs=[status_output, results_table]
|
| 192 |
)
|
| 193 |
|