Update app.py
Browse files
app.py
CHANGED
|
@@ -22,8 +22,8 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 22 |
class BasicAgent:
|
| 23 |
def __init__(self):
|
| 24 |
self.agent = alfred
|
| 25 |
-
|
| 26 |
-
state_dict =
|
| 27 |
response = state_dict["messages"][-1]
|
| 28 |
try:
|
| 29 |
print(response)
|
|
@@ -96,7 +96,7 @@ async def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 96 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 97 |
continue
|
| 98 |
try:
|
| 99 |
-
submitted_answer =
|
| 100 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 101 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 102 |
except Exception as e:
|
|
|
|
| 22 |
class BasicAgent:
|
| 23 |
def __init__(self):
|
| 24 |
self.agent = alfred
|
| 25 |
+
def __call__(self, question: str) -> str:
|
| 26 |
+
state_dict = alfred.invoke({"messages": [HumanMessage(content = question)]})
|
| 27 |
response = state_dict["messages"][-1]
|
| 28 |
try:
|
| 29 |
print(response)
|
|
|
|
| 96 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 97 |
continue
|
| 98 |
try:
|
| 99 |
+
submitted_answer = agent(question_text)
|
| 100 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 101 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 102 |
except Exception as e:
|