hp1318 commited on
Commit
4be5ef0
·
verified ·
1 Parent(s): 73cb380

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -39,13 +39,13 @@ def get_air_quality(city: str) -> str:
39
  """
40
  try:
41
  search_tool = DuckDuckGoSearchTool()
42
- query = f"current air quality index AQI in {city}"
43
  results = search_tool.forward(query)
44
-
45
  if results:
46
- top_result = results.split("\n\n")[0] # Get the first search result
47
- return f"Air Quality in {city}:\n{top_result}"
48
- return "No AQI data found."
49
  except Exception as e:
50
  return f"Error fetching AQI: {e}"
51
 
 
39
  """
40
  try:
41
  search_tool = DuckDuckGoSearchTool()
42
+ query = f"current AQI in {city} site:aqicn.org"
43
  results = search_tool.forward(query)
44
+
45
  if results:
46
+ top_result = results.split("\n\n")[0] # Get the most relevant result
47
+ return f"AQI in {city}: {top_result}"
48
+ return f"No AQI data found for {city}."
49
  except Exception as e:
50
  return f"Error fetching AQI: {e}"
51