samih-7 commited on
Commit
ae5f0b3
·
verified ·
1 Parent(s): f3169b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -7,8 +7,6 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
10
- search_tool = DuckDuckGoSearchTool(max_results=10)
11
-
12
  @tool
13
  def search_web(query:str)-> str:
14
  """A tool that runs a DuckDuckGo search and returns a formatted result.
@@ -16,9 +14,14 @@ def search_web(query:str)-> str:
16
  query: A string representing the query to search for.
17
  """
18
  try:
19
- results = search_tool(query)
20
- print(f"Results: {results}")
21
- return results
 
 
 
 
 
22
  except Exception as e:
23
  return f"Error running search: {str(e)}"
24
 
 
7
 
8
  from Gradio_UI import GradioUI
9
 
 
 
10
  @tool
11
  def search_web(query:str)-> str:
12
  """A tool that runs a DuckDuckGo search and returns a formatted result.
 
14
  query: A string representing the query to search for.
15
  """
16
  try:
17
+ response = requests.get(
18
+ "https://lite.duckduckgo.com/lite/",
19
+ params={"q": query},
20
+ headers={"User-Agent": "Mozilla/5.0"},
21
+ )
22
+ response.raise_for_status()
23
+ print(f"Response: {response}")
24
+ return response
25
  except Exception as e:
26
  return f"Error running search: {str(e)}"
27