Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,8 +19,36 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 19 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
| 20 |
# return fixed_answer
|
| 21 |
|
| 22 |
-
###############
|
| 23 |
-
## My Stuff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
###############
|
| 25 |
|
| 26 |
# from smolagents import DuckDuckGoSearchTool
|
|
@@ -31,7 +59,7 @@ search_tool = DuckDuckGoSearchTool()
|
|
| 31 |
|
| 32 |
# Example usage
|
| 33 |
results = search_tool("Who's the current President of France?")
|
| 34 |
-
print(results)
|
| 35 |
|
| 36 |
|
| 37 |
class BasicAgent:
|
|
@@ -47,6 +75,7 @@ class BasicAgent:
|
|
| 47 |
|
| 48 |
#########################################################
|
| 49 |
|
|
|
|
| 50 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 51 |
"""
|
| 52 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
|
| 19 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
| 20 |
# return fixed_answer
|
| 21 |
|
| 22 |
+
# ###############
|
| 23 |
+
# ## My Stuff
|
| 24 |
+
# ###############
|
| 25 |
+
|
| 26 |
+
# # from smolagents import DuckDuckGoSearchTool
|
| 27 |
+
# from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 28 |
+
|
| 29 |
+
# # Initialize the DuckDuckGo search tool
|
| 30 |
+
# search_tool = DuckDuckGoSearchTool()
|
| 31 |
+
|
| 32 |
+
# # Example usage
|
| 33 |
+
# results = search_tool("Who's the current President of France?")
|
| 34 |
+
# print(results)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# class BasicAgent:
|
| 38 |
+
# def __init__(self):
|
| 39 |
+
# search_tool = DuckDuckGoSearchTool()
|
| 40 |
+
# print("BasicAgent initialized.")
|
| 41 |
+
# def __call__(self, question: str) -> str:
|
| 42 |
+
# print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 43 |
+
# unfixed_answer = search_tool(question)
|
| 44 |
+
# fixed_answer = "This is a default answer."
|
| 45 |
+
# print(f"Agent returning unfixed answer: {unfixed_answer}")
|
| 46 |
+
# return unfixed_answer
|
| 47 |
+
|
| 48 |
+
# #########################################################
|
| 49 |
+
|
| 50 |
+
##############
|
| 51 |
+
## My Stuff 2
|
| 52 |
###############
|
| 53 |
|
| 54 |
# from smolagents import DuckDuckGoSearchTool
|
|
|
|
| 59 |
|
| 60 |
# Example usage
|
| 61 |
results = search_tool("Who's the current President of France?")
|
| 62 |
+
# print(results)
|
| 63 |
|
| 64 |
|
| 65 |
class BasicAgent:
|
|
|
|
| 75 |
|
| 76 |
#########################################################
|
| 77 |
|
| 78 |
+
|
| 79 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 80 |
"""
|
| 81 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|