Skip to content

Commit 30040d8

Browse files
committed
added multiple tag support
1 parent fc2a634 commit 30040d8

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

roboflow/core/project.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def __image_upload(
264264
hosted_image=False,
265265
split="train",
266266
batch_name=DEFAULT_BATCH_NAME,
267-
tag_name="",
267+
tag_names=[],
268268
):
269269
"""function to upload image to the specific project
270270
:param image_path: path to image you'd like to upload.
@@ -293,10 +293,13 @@ def __image_upload(
293293
self.__api_key,
294294
"&batch=",
295295
batch_name,
296-
"&tag=",
297-
tag_name,
298296
]
299297
)
298+
print(tag_names)
299+
for tag in tag_names:
300+
self.image_upload_url = self.image_upload_url + f"&tag={tag}"
301+
302+
print(self.image_upload_url)
300303

301304
# Convert to PIL Image
302305
img = cv2.imread(image_path)
@@ -385,7 +388,7 @@ def upload(
385388
split: str = "train",
386389
num_retry_uploads: int = 0,
387390
batch_name: str = DEFAULT_BATCH_NAME,
388-
tag_name: str = "",
391+
tag_names: list = [],
389392
):
390393
"""Upload image function based on the RESTful API
391394
@@ -397,7 +400,7 @@ def upload(
397400
split (str) - to upload the image to
398401
num_retry_uploads (int) - how many times to retry upload on failure
399402
batch_name (str) - name of batch to upload to within project
400-
tag_name (str) - tags to be applied to an image
403+
tag_names (list[str]) - tags to be applied to an image
401404
402405
Returns:
403406
None - returns nothing
@@ -435,7 +438,7 @@ def upload(
435438
split=split,
436439
num_retry_uploads=num_retry_uploads,
437440
batch_name=batch_name,
438-
tag_name=tag_name,
441+
tag_names=tag_names,
439442
)
440443
else:
441444
images = os.listdir(image_path)
@@ -450,7 +453,7 @@ def upload(
450453
split=split,
451454
num_retry_uploads=num_retry_uploads,
452455
batch_name=batch_name,
453-
tag_name=tag_name,
456+
tag_names=tag_names,
454457
)
455458
print("[ " + path + " ] was uploaded succesfully.")
456459
else:
@@ -466,7 +469,7 @@ def single_upload(
466469
split="train",
467470
num_retry_uploads=0,
468471
batch_name=DEFAULT_BATCH_NAME,
469-
tag_name="",
472+
tag_names=[],
470473
):
471474

472475
success = False
@@ -479,7 +482,7 @@ def single_upload(
479482
hosted_image=hosted_image,
480483
split=split,
481484
batch_name=batch_name,
482-
tag_name=tag_name,
485+
tag_names=tag_names,
483486
)
484487
# Get JSON response values
485488
try:

0 commit comments

Comments
 (0)