Skip to content

Commit

Permalink
Merge pull request #693 from fa0311/main
Browse files Browse the repository at this point in the history
Fixed bugs related to sum
  • Loading branch information
danielgatis authored Nov 30, 2024
2 parents e740a96 + 9e6c461 commit 5435d2f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions rembg/sessions/sam.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from copy import deepcopy
from typing import Dict, List, Tuple
from typing import List

import cv2
import numpy as np
Expand Down Expand Up @@ -105,9 +105,10 @@ def __init__(
valid_providers = []
available_providers = ort.get_available_providers()

for provider in providers or []:
if provider in available_providers:
valid_providers.append(provider)
if providers:
for provider in providers or []:
if provider in available_providers:
valid_providers.append(provider)
else:
valid_providers.extend(available_providers)

Expand Down Expand Up @@ -142,7 +143,16 @@ def predict(
Returns:
List[PILImage]: A list of masks generated by the decoder.
"""
prompt = kwargs.get("sam_prompt", "{}")
prompt = kwargs.get(
"sam_prompt",
[
{
"type": "point",
"label": 1,
"data": [int(img.width / 2), int(img.height / 2)],
}
],
)
schema = {
"type": "array",
"items": {
Expand Down

0 comments on commit 5435d2f

Please sign in to comment.