Skip to content

Commit

Permalink
fuyu attempted fix
Browse files Browse the repository at this point in the history
Former-commit-id: bcf2b88
  • Loading branch information
Kye committed Nov 11, 2023
1 parent 7c87a37 commit 7bf0f75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
Expand Down
13 changes: 10 additions & 3 deletions swarms/models/fuyu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


0 comments on commit 7bf0f75

Please sign in to comment.