Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,41 @@ 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 |
class BasicAgent:
|
| 14 |
def __init__(self):
|
|
|
|
| 15 |
print("BasicAgent initialized.")
|
| 16 |
def __call__(self, question: str) -> str:
|
| 17 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 18 |
fixed_answer = "This is a default answer."
|
| 19 |
-
print(f"Agent returning
|
| 20 |
-
return
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 23 |
"""
|
|
|
|
| 10 |
|
| 11 |
# --- Basic Agent Definition ---
|
| 12 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 13 |
+
# class BasicAgent:
|
| 14 |
+
# def __init__(self):
|
| 15 |
+
# print("BasicAgent initialized.")
|
| 16 |
+
# def __call__(self, question: str) -> str:
|
| 17 |
+
# print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 18 |
+
# fixed_answer = "This is a default answer."
|
| 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 |
+
|
| 28 |
+
# Initialize the DuckDuckGo search tool
|
| 29 |
+
search_tool = DuckDuckGoSearchTool()
|
| 30 |
+
|
| 31 |
+
# Example usage
|
| 32 |
+
results = search_tool("Who's the current President of France?")
|
| 33 |
+
print(results)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
class BasicAgent:
|
| 37 |
def __init__(self):
|
| 38 |
+
search_tool = DuckDuckGoSearchTool()
|
| 39 |
print("BasicAgent initialized.")
|
| 40 |
def __call__(self, question: str) -> str:
|
| 41 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 42 |
+
unfixed_answer = search_tool(question)
|
| 43 |
fixed_answer = "This is a default answer."
|
| 44 |
+
print(f"Agent returning unfixed answer: {unfixed_answer}")
|
| 45 |
+
return unfixed_answer
|
| 46 |
+
|
| 47 |
+
#########################################################
|
| 48 |
|
| 49 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 50 |
"""
|