Spaces:
Runtime error
Runtime error
Update app.py
Browse files32 unmodified lines33343536373832 unmodified linesexcept Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"final_answer = FinalAnswerTool()32 unmodified lines33343536373839404142434445464748495051525354555657585960616263646532 unmodified linesexcept Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"@tooldef fetch_artist_networth(artist_name):"""Fetches the net worth of an artist by scraping search result snippets.Args:artist_name (str): Name of the artist (e.g., "Beyoncé")Returns:str: Net worth (e.g., "800 million") or a fallback message."""query = f"artist_name net worth"headers = "User-Agent": "Mozilla/5.0"res = requests.get("https://www.google.com/search", params="q": query, headers=headers)soup = BeautifulSoup(res.text, "html.parser")# Try to find a rich result or snippet line containing "... million/billion"snippet = soup.find("div", class_="BNeawe")if snippet:text = snippet.get_text()import rematch = re.search(r"\$\d+(?:\.\d+)?\s*(?:million|billion)", text, re.IGNORECASE)if match:return match.group(0)return "Net worth not found 🤷"final_answer = FinalAnswerTool()
app.py+27