Spaces:
Restarting
Restarting
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
|
|
6 |
|
7 |
# (Keep Constants as is)
|
8 |
# --- Constants ---
|
@@ -10,14 +11,16 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
10 |
|
11 |
# --- Basic Agent Definition ---
|
12 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
23 |
"""
|
@@ -80,7 +83,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
80 |
print(f"Skipping item with missing task_id or question: {item}")
|
81 |
continue
|
82 |
try:
|
83 |
-
|
|
|
84 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
85 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
86 |
except Exception as e:
|
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
+
from agent import Agent
|
7 |
|
8 |
# (Keep Constants as is)
|
9 |
# --- Constants ---
|
|
|
11 |
|
12 |
# --- Basic Agent Definition ---
|
13 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
14 |
+
|
15 |
+
# TODO: delete
|
16 |
+
# class BasicAgent:
|
17 |
+
# def __init__(self):
|
18 |
+
# print("BasicAgent initialized.")
|
19 |
+
# def __call__(self, question: str) -> str:
|
20 |
+
# print(f"Agent received question (first 50 chars): {question[:50]}...")
|
21 |
+
# fixed_answer = "This is a default answer."
|
22 |
+
# print(f"Agent returning fixed answer: {fixed_answer}")
|
23 |
+
# return fixed_answer
|
24 |
|
25 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
26 |
"""
|
|
|
83 |
print(f"Skipping item with missing task_id or question: {item}")
|
84 |
continue
|
85 |
try:
|
86 |
+
agent = Agent(item)
|
87 |
+
submitted_answer = agent.run_task()
|
88 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
89 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
90 |
except Exception as e:
|