Spaces:
Sleeping
Sleeping
Update app.py
Browse filesartist networt
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
@@ -44,9 +45,9 @@ def fetch_artist_networth(artist_name):
|
|
| 44 |
Returns:
|
| 45 |
str: Net worth (e.g., "800 million") or a fallback message.
|
| 46 |
"""
|
| 47 |
-
query = f"artist_name net worth"
|
| 48 |
-
headers = "User-Agent": "Mozilla/5.0"
|
| 49 |
-
res = requests.get("https://www.google.com/search", params="q": query, headers=headers)
|
| 50 |
soup = BeautifulSoup(res.text, "html.parser")
|
| 51 |
|
| 52 |
# Try to find a rich result or snippet line containing "... million/billion"
|
|
@@ -61,6 +62,7 @@ def fetch_artist_networth(artist_name):
|
|
| 61 |
return "Net worth not found 🤷"
|
| 62 |
|
| 63 |
|
|
|
|
| 64 |
final_answer = FinalAnswerTool()
|
| 65 |
|
| 66 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from bs4 import BeautifulSoup
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
|
|
|
| 45 |
Returns:
|
| 46 |
str: Net worth (e.g., "800 million") or a fallback message.
|
| 47 |
"""
|
| 48 |
+
query = f"{artist_name} net worth"
|
| 49 |
+
headers = {"User-Agent": "Mozilla/5.0"}
|
| 50 |
+
res = requests.get("https://www.google.com/search", params={"q": query}, headers=headers)
|
| 51 |
soup = BeautifulSoup(res.text, "html.parser")
|
| 52 |
|
| 53 |
# Try to find a rich result or snippet line containing "... million/billion"
|
|
|
|
| 62 |
return "Net worth not found 🤷"
|
| 63 |
|
| 64 |
|
| 65 |
+
|
| 66 |
final_answer = FinalAnswerTool()
|
| 67 |
|
| 68 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|