Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,20 +7,19 @@ from tools.final_answer import FinalAnswerTool
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
-
|
11 |
-
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
12 |
@tool
|
13 |
def get_news_headlines() -> str:
|
14 |
"""
|
15 |
-
Fetches the top news headlines from the News API for
|
16 |
This function makes a GET request to the News API to retrieve the top news headlines
|
17 |
-
for
|
18 |
formatted string. If no articles are available, it returns a message indicating that
|
19 |
no news is available. In case of a request error, it returns an error message.
|
20 |
Returns:
|
21 |
str: A string containing the top 5 news headlines and their sources, or an error message.
|
22 |
"""
|
23 |
-
api_key = "2f90b8ee0ea64f08b2e9a4c9a13a69c4"
|
24 |
url = f"https://newsapi.org/v2/top-headlines?country=us&apiKey={api_key}"
|
25 |
|
26 |
try:
|
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
+
|
|
|
11 |
@tool
|
12 |
def get_news_headlines() -> str:
|
13 |
"""
|
14 |
+
Fetches the top news headlines from the News API for the united states of America.
|
15 |
This function makes a GET request to the News API to retrieve the top news headlines
|
16 |
+
for the united states of America. It returns the titles and sources of the top 5 articles as a
|
17 |
formatted string. If no articles are available, it returns a message indicating that
|
18 |
no news is available. In case of a request error, it returns an error message.
|
19 |
Returns:
|
20 |
str: A string containing the top 5 news headlines and their sources, or an error message.
|
21 |
"""
|
22 |
+
api_key = "2f90b8ee0ea64f08b2e9a4c9a13a69c4"
|
23 |
url = f"https://newsapi.org/v2/top-headlines?country=us&apiKey={api_key}"
|
24 |
|
25 |
try:
|