Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,10 +26,14 @@ def submit_answers(answers, username, code_link):
|
|
26 |
return {"message": "Submission failed.", "score": 0}
|
27 |
|
28 |
def run_and_submit():
|
|
|
29 |
questions = fetch_questions()
|
|
|
|
|
30 |
answers = []
|
31 |
for q in questions:
|
32 |
-
|
|
|
33 |
answers.append({
|
34 |
"task_id": q["task_id"],
|
35 |
"submitted_answer": answer
|
@@ -37,7 +41,10 @@ def run_and_submit():
|
|
37 |
|
38 |
username = get_hf_username()
|
39 |
code_link = get_code_link()
|
|
|
|
|
40 |
result = submit_answers(answers, username, code_link)
|
|
|
41 |
return f"Score: {result.get('score', 0)}\nMessage: {result.get('message', 'No message')}"
|
42 |
|
43 |
with gr.Blocks() as demo:
|
|
|
26 |
return {"message": "Submission failed.", "score": 0}
|
27 |
|
28 |
def run_and_submit():
|
29 |
+
print("Fetching questions...")
|
30 |
questions = fetch_questions()
|
31 |
+
print(f"Fetched {len(questions)} questions")
|
32 |
+
|
33 |
answers = []
|
34 |
for q in questions:
|
35 |
+
print(f"Running agent on task {q['task_id']}")
|
36 |
+
answer = run_agent_on_question(q)
|
37 |
answers.append({
|
38 |
"task_id": q["task_id"],
|
39 |
"submitted_answer": answer
|
|
|
41 |
|
42 |
username = get_hf_username()
|
43 |
code_link = get_code_link()
|
44 |
+
print(f"Submitting answers as {username} with code link {code_link}")
|
45 |
+
|
46 |
result = submit_answers(answers, username, code_link)
|
47 |
+
print(result)
|
48 |
return f"Score: {result.get('score', 0)}\nMessage: {result.get('message', 'No message')}"
|
49 |
|
50 |
with gr.Blocks() as demo:
|