diff --git a/pyproject.toml b/pyproject.toml index 267342242..d1dfd8295 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "2.2.0" +version = "2.2.1" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/swarms/models/fuyu.py b/swarms/models/fuyu.py index dd664f516..bba2068c9 100644 --- a/swarms/models/fuyu.py +++ b/swarms/models/fuyu.py @@ -75,6 +75,13 @@ def __call__(self, text: str, img: str): def get_img_from_web(self, img_url: str): """Get the image from the web""" - response = requests.get(img_url) - image_pil = Image.open(BytesIO(response.content)) - return image_pil + try: + response = requests.get(img_url) + response.raise_for_status() + image_pil = Image.open(BytesIO(response.content)) + return image_pil + except requests.RequestException as error: + print(f"Error fetching image from {img_url} and error: {error}") + return None + + \ No newline at end of file