Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,20 +4,17 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
import gaia_agent as ga
|
| 7 |
-
|
| 8 |
-
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
| 11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 12 |
-
global llm
|
| 13 |
# --- Basic Agent Definition ---
|
| 14 |
-
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 15 |
class BasicAgent:
|
| 16 |
"""A langgraph agent."""
|
| 17 |
-
|
| 18 |
def __init__(self):
|
| 19 |
print("BasicAgent initialized.")
|
| 20 |
-
|
| 21 |
llm = ga.connect_models()
|
| 22 |
self.agent = ga.create_agent_workflow()
|
| 23 |
|
|
@@ -27,9 +24,11 @@ class BasicAgent:
|
|
| 27 |
result = self.agent.invoke({
|
| 28 |
"question": question
|
| 29 |
})
|
| 30 |
-
|
|
|
|
| 31 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 32 |
return fixed_answer
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
import gaia_agent as ga
|
| 7 |
+
global llm
|
|
|
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
| 10 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 11 |
# --- Basic Agent Definition ---
|
|
|
|
| 12 |
class BasicAgent:
|
| 13 |
"""A langgraph agent."""
|
| 14 |
+
|
| 15 |
def __init__(self):
|
| 16 |
print("BasicAgent initialized.")
|
| 17 |
+
global llm
|
| 18 |
llm = ga.connect_models()
|
| 19 |
self.agent = ga.create_agent_workflow()
|
| 20 |
|
|
|
|
| 24 |
result = self.agent.invoke({
|
| 25 |
"question": question
|
| 26 |
})
|
| 27 |
+
answer = result.get("final_answer", "No answer generated")
|
| 28 |
+
fixed_answer=str(answer).strip().lower()
|
| 29 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 30 |
return fixed_answer
|
| 31 |
+
|
| 32 |
|
| 33 |
|
| 34 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|