Spaces:
Sleeping
Sleeping
Update app.py
Browse files7 unmodified lines8910111213141516171819202122232425262728297 unmodified linesfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef get_latest_business_news(topic: str) -> str:"""Fetches the latest business news about a given topic using DuckDuckGo search.Args:topic: The business-related topic to search for (e.g., "AI in FMCG", "Retail trends 2024").Returns:A short summary of the latest news related to the topic."""try:search_tool = DuckDuckGoSearchTool()results = search_tool.search(f"latest business news about {topic}") # Correct method callreturn f"Here are the latest updates on {topic}:\n" + "\n".join(results[:3]) # Top 3 resultsexcept Exception as e:return f"Error fetching news: {str(e)}"@tool7 unmodified lines891011121314151617181920212223242526272829303132337 unmodified linesfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !import feedparser@tooldef get_latest_business_news_rss() -> str:"""Fetches the latest business news headlines from Google News RSS.Returns:A short summary of the latest business news headlines."""try:# Google News RSS feed for Businessrss_url = "https://news.google.com/rss/topics/CAAqJggKIiBDQkFTRWdvSUwyMHZNREZxYUdjU0JtVnpMVFF4T1NnQVAB?hl=en&gl=US&ceid=US:en"feed = feedparser.parse(rss_url)news_items = [f"- {entry.title} (Source: {entry.source.title})" for entry in feed.entries[:5]] # Get top 5 news itemsreturn f"Here are the latest business news updates from Google News:\n" + "\n".join(news_items)except Exception as e:return f"Error fetching business news: {str(e)}"@tool
app.py+14-10