Skip to content

Commit

Permalink
chore: Update .gitignore and add .python-version file
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgatis committed Aug 4, 2024
1 parent 688b348 commit ed1c295
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ __pycache__/
*~≈
.env
.envrc
.python-version
.idea
.pytest_cache

Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.4
6 changes: 3 additions & 3 deletions rembg/bg.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ def remove(
"""
if isinstance(data, bytes) or force_return_bytes:
return_type = ReturnType.BYTES
img = Image.open(io.BytesIO(cast(bytes, data)))
img = cast(PILImage, Image.open(io.BytesIO(cast(bytes, data))))
elif isinstance(data, PILImage):
return_type = ReturnType.PILLOW
img = data
img = cast(PILImage, data)
elif isinstance(data, np.ndarray):
return_type = ReturnType.NDARRAY
img = Image.fromarray(data)
img = cast(PILImage, Image.fromarray(data))
else:
raise ValueError(
"Input type {} is not supported. Try using force_return_bytes=True to force python bytes output".format(
Expand Down

0 comments on commit ed1c295

Please sign in to comment.