Skip to content

Commit b7d68c7

Browse files
committed
Fix import issue
1 parent 1801150 commit b7d68c7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

abraia/training/dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from tqdm import tqdm
1010
from PIL import Image
11-
from io import BytesIO
12-
from transformers import pipeline
1311

1412
from ..client import Abraia
1513
from ..utils import HEADERS, load_image, load_url, list_dir, url_path
@@ -132,6 +130,7 @@ def detect_dino(img, classes, threshold=0.3, pipe=None):
132130
classes = [label.lower().strip() for label in classes]
133131
labels = [f"{label}." if not label.endswith('.') else label for label in classes]
134132
if pipe is None:
133+
from transformers import pipeline
135134
pipe = pipeline(task="zero-shot-object-detection", model="IDEA-Research/grounding-dino-tiny")
136135
results = pipe(Image.fromarray(img), candidate_labels=labels, threshold=threshold)
137136

@@ -215,6 +214,7 @@ def load(self):
215214
return self
216215

217216
def annotate(self, label, segment=False, callback=None):
217+
from transformers import pipeline
218218
annotated_filenames = {a['filename'] for a in self.annotations}
219219
images = [img for img in self.images if img['name'] not in annotated_filenames]
220220
pipe = pipeline(task="zero-shot-object-detection", model="IDEA-Research/grounding-dino-tiny")

0 commit comments

Comments
 (0)