final_answer return the image
Browse filesthe output is now the actual logo image, not just the url
app.py
CHANGED
@@ -4,6 +4,8 @@ import requests
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
@@ -25,10 +27,12 @@ def company_logos(company_name: str, _: int) -> str:
|
|
25 |
logo_url = f"https://logo.clearbit.com/{company_domain}?token=sk_VoU5zjclT8Ot9RoyAbAh9g"
|
26 |
|
27 |
try:
|
28 |
-
# Make a request to
|
29 |
response = requests.get(logo_url)
|
30 |
if response.status_code == 200:
|
31 |
-
|
|
|
|
|
32 |
else:
|
33 |
return f"Could not find a logo for {company_name}."
|
34 |
except Exception as e:
|
|
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
+
from PIL import Image
|
8 |
+
from io import BytesIO
|
9 |
|
10 |
from Gradio_UI import GradioUI
|
11 |
|
|
|
27 |
logo_url = f"https://logo.clearbit.com/{company_domain}?token=sk_VoU5zjclT8Ot9RoyAbAh9g"
|
28 |
|
29 |
try:
|
30 |
+
# Make a request to get the logo image
|
31 |
response = requests.get(logo_url)
|
32 |
if response.status_code == 200:
|
33 |
+
# Convert response content to an image
|
34 |
+
image = Image.open(BytesIO(response.content))
|
35 |
+
return image
|
36 |
else:
|
37 |
return f"Could not find a logo for {company_name}."
|
38 |
except Exception as e:
|