Spaces:
Sleeping
Sleeping
Update app.py
Browse files9 unmodified lines1011121314151617183 unmodified lines22232425262728299 unmodified linesfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !api_key = os.getenv("NEWSAPI_API_KEY")@tooldef get_ai_news(keyword: str, language: str = "en", page_size: int=5) -> str:"""Fetches the latest news articles related to Artificial Intelligence or a specified keyword.3 unmodified lineslanguage: The language of the articles (e.g., "en" for English, "es" for Spanish).page_size: The number of top articles to retrieve (max 10 for free tier effective use)."""if not api_key:return "Error: NewsAPI.org API key not configured. Please add it as NEWSAPI_API_KEY secret."url = "https://newsapi.org/v2/everything"params = {9 unmodified lines1011121314153 unmodified lines192021222324252627289 unmodified linesfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef get_ai_news(keyword: str, language: str = "en", page_size: int=5) -> str:"""Fetches the latest news articles related to Artificial Intelligence or a specified keyword.3 unmodified lineslanguage: The language of the articles (e.g., "en" for English, "es" for Spanish).page_size: The number of top articles to retrieve (max 10 for free tier effective use)."""try:api_key = os.getenv("NEWSAPI_API_KEY")if not api_key:return "Error: NewsAPI.org API key not configured. Please add it as NEWSAPI_API_KEY secret."url = "https://newsapi.org/v2/everything"params = {
app.py+4-5