Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ class BasicAgent:
|
|
36 |
]
|
37 |
return random.choice(browsers)
|
38 |
|
39 |
-
def search(self, query: str, num_results: int =
|
40 |
encoded_query = urllib.parse.quote_plus(query)
|
41 |
url = f"https://www.google.com/search?q={encoded_query}&num={num_results + 2}"
|
42 |
|
@@ -80,16 +80,6 @@ class BasicAgent:
|
|
80 |
"""Added this to make the agent callable"""
|
81 |
return self.pretty_print(self.search(query))
|
82 |
|
83 |
-
if __name__ == "__main__":
|
84 |
-
agent = BasicAgent()
|
85 |
-
|
86 |
-
# Now you can use either approach:
|
87 |
-
# Option 1: Call as function
|
88 |
-
print(agent("Python programming language"))
|
89 |
-
|
90 |
-
# Option 2: Use methods directly
|
91 |
-
results = agent.search("Python programming language")
|
92 |
-
print(agent.pretty_print(results))
|
93 |
|
94 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
95 |
"""
|
|
|
36 |
]
|
37 |
return random.choice(browsers)
|
38 |
|
39 |
+
def search(self, query: str, num_results: int = 20) -> List[Dict]:
|
40 |
encoded_query = urllib.parse.quote_plus(query)
|
41 |
url = f"https://www.google.com/search?q={encoded_query}&num={num_results + 2}"
|
42 |
|
|
|
80 |
"""Added this to make the agent callable"""
|
81 |
return self.pretty_print(self.search(query))
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
85 |
"""
|