Update app.py
Browse files
app.py
CHANGED
|
@@ -21,15 +21,15 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 21 |
class BasicAgent:
|
| 22 |
def __init__(self):
|
| 23 |
self.agent = alfred
|
| 24 |
-
|
| 25 |
-
state_dict =
|
| 26 |
response = state_dict["messages"][-1]
|
| 27 |
try:
|
| 28 |
return response.content
|
| 29 |
except:
|
| 30 |
return "Sorry, I can't answer to this question."
|
| 31 |
|
| 32 |
-
|
| 33 |
"""
|
| 34 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 35 |
and displays the results.
|
|
|
|
| 21 |
class BasicAgent:
|
| 22 |
def __init__(self):
|
| 23 |
self.agent = alfred
|
| 24 |
+
def __call__(self, question: str) -> str:
|
| 25 |
+
state_dict = alfred.invoke({"messages": [HumanMessage(content = question)]})
|
| 26 |
response = state_dict["messages"][-1]
|
| 27 |
try:
|
| 28 |
return response.content
|
| 29 |
except:
|
| 30 |
return "Sorry, I can't answer to this question."
|
| 31 |
|
| 32 |
+
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 33 |
"""
|
| 34 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
| 35 |
and displays the results.
|